一、环境配置
在allure_report目录下(这个目录是生成最后的html报告之前,生成依赖文件的目录 )
下创建 environment.properties或者environment.xml文件 和 categories.json文件
environment.properties
Browser=Chrome
Browser.Version=63.0
Stand=Production
ApiUrl=127.0.0.1/login
python.Version=3.6
environment.xml
<environment> <parameter> <key>Browser</key> <value>Chrome</value> </parameter> <parameter> <key>Browser.Version</key> <value>63.0</value> </parameter> <parameter> <key>Stand</key> <value>Production</value> </parameter> <parameter> <key>ApiUrl</key> <value>127.0.0.1/login</value> </parameter> <parameter> <key>python.Version</key> <value>3.6</value> </parameter> </environment>
categories.json
[ { "name": "Ignored tests", "matchedStatuses": ["skipped"] }, { "name": "Infrastructure problems", "matchedStatuses": ["broken", "failed"], "messageRegex": ".*bye-bye.*" }, { "name": "Outdated tests", "matchedStatuses": ["broken"], "traceRegex": ".*FileNotFoundException.*" }, { "name": "Product defects", "matchedStatuses": ["failed"] }, { "name": "Test defects", "matchedStatuses": ["broken"] } ]
二、装饰器(需要导入import allure)
在页面操作方法引入,作用使测试用例在allure报告中能够更加详细的显示测试过程
效果:
测试方法引入,可以重命名测试用例在allure报告中的名称,test_allure_feature.py文件修改如下代码
效果:
使用allure.attach可以给报告中添加文件,图片,log,html代码等等。
描述测试用例
效果:
测试用例增加链接
效果:
feature和story被称为行为驱动标记,因为使用这个两个标记,通过报告可以更加清楚的掌握每个测试用例的功能和每个测试用例的测试场景
效果:
测试用例级别,分为blocker,critical,normal,minor,trivial5个级别