allure生成定制化报告学习

参考资料:

安装allure:https://www.jianshu.com/p/8c2a696090cd

安装pytest:https://www.jianshu.com/p/8c2a696090cd

配置python  virtualenv虚拟环境:https://www.jianshu.com/p/dc9501777225

pytest生成xml:https://www.jianshu.com/p/c5c9ad16b1bf

allure生成html报告:https://www.jianshu.com/p/7e3d0d7c3b38

直接使用命令行生成
allure generate ./reports/xml -o ./reports/html --clean

allure装饰器汇总:https://www.jianshu.com/p/93235504ce7f

allure输出报告的层级控制:https://www.jianshu.com/p/c92b936d65a2

allure tag标签:https://www.jianshu.com/p/93665779d983

allure报告添加附件:https://www.jianshu.com/p/ce411e44499a

 

参考博客:https://www.cnblogs.com/xiaogongjin/p/11705134.html

这里以allure+pytest进行讲解:

使用之前需要导入allure模块

import allure

1、feature--测试用例主要功能模块

使用pytest框架编写用例时,一般一个py文件内的一个class就是属于一个大模块,如果想在报告内显示单独的模块,在class类前使用方法@allure.feayure()方法

 2、story——feature功能模块下的分支功能,使用方法:@allure.story()

3、severity——测试用例的严重级别

  Allure中对严重级别的定义:

    • blocker级别:中断缺陷(客户端程序无响应,无法执行下一步操作)

    • critical级别:临界缺陷( 功能点缺失)

    • normal级别:普通缺陷(数值计算错误)

    • minor级别:次要缺陷(界面错误与UI需求不符)

    • trivial级别:轻微缺陷(必输项无提示,或者提示不规范)

  使用方法:@allure.severity(allure.severity_level.CRITICAL)  或者  @allure.severity('critical')

 

4、step——测试用例的步骤

  使用方法:[email protected]()  只能以装饰器的形式放在类或者方法上面  2.with allure.step():  可以放在测试用例方法里面,但测试步骤的代码需要被该语句包含

猜你喜欢

转载自www.cnblogs.com/guozhijia/p/12632788.html