pytest之生成allure测试报告

一、Mac安装allure

命令行:brew install allure
安装踩坑及解决:https://blog.csdn.net/weixin_39589455/article/details/120508364

二、在pytest.ini文件中加入命令生成json格式的临时报告

addopts =-vs --alluredir ./temp

三、命令行执行命令

allure generate ./temp -o ./report --clean

allure generate :命令语法
./temp:找到json的临时报告
-o ./report:在report目录下生成allure报告
–clean:每次运行都删除点之前的

五、allure报告展示

在这里插入图片描述

六、allure报告的定制命令

  1. 系统名:@allure.epic()

  2. 模块名-某个测试模块名:@allure.feature()

  3. 故事名-某总case:@allure.story()

  4. 标题名-可结合测试用例中的标题,对传入的某一参数作为标题:@allure.title()

  5. 用例登记:blocker(阻塞)、critical、normal、minor(次要)、trivial(轻微):@allure.severity()

  6. 可以加入URL:@allure.issue(‘http://www.baidu.com’, ‘百度一下’)

  7. 测试步骤,pytest.step(),例如:
    @allure.step(“登录接口测试步骤”)
    def test_login(args):

    with allure.step(“接口返回:\n”+rep):
    print(“步骤1”)
    with allure.step(“步骤二”):
    print(“步骤二”)

  8. 添加文本等:pytest.attach(body, name),例如:
    allure.attach(body=rep, name=“接口返回”)
    pytest.attach.file(source, name, attament_type, extension)

  9. 添加图片等文件:allure.attach.file(source="/Users/dongshuai/PycharmProjects/interface2/output/2651630979211_.pic.jpg",
    name=“这是图片名”,
    attachment_type=None,
    extension=None)

七、用例名过长影响美观

https://blog.csdn.net/qq_38032510/article/details/118859449

八、趋势图展示

https://blog.csdn.net/RoninYang/article/details/111245351

九、jenkins生成allure报告

https://www.cnblogs.com/clairejing/p/9755201.html

十、报告添加环境变量

https://blog.csdn.net/weixin_42176112/article/details/120845207

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值