前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >httprunner 3.x入门 -5 生成allure报告

httprunner 3.x入门 -5 生成allure报告

作者头像
孟船长
发布2022-04-12 14:35:12
6550
发布2022-04-12 14:35:12
举报
文章被收录于专栏:自动化测试实战

先简单说一下allure安装方法

1、下载allure文件

2、解压到非中文目录

3、把bin路径配置到环境变量

4、安装allure报告:pip install allure-pytest

5、验证:allure --version

生成allure报告

修改一下执行命令即可

原来是

代码语言:javascript
复制
# coding: utf-8

import os

if __name__ == '__main__':
    os.system("hrun testsuites/tags_suits.yml --html=reports/report.html")

生成allure需要两步,先生成json数据文件,然后生成allure测试报告

代码语言:javascript
复制
# coding: utf-8

import os
import time

if __name__ == '__main__':
    # 生成临时文件
    os.system("hrun testsuites/tags_suits.yml --alluredir=reports/temps --clean-alluredir")
    # 生成文件需要时间,等待3秒
    time.sleep(3)
    # 生成allure报告
    os.system("allure generate reports/temps -o reports/allure-report --clean")

生成的json文件会越来越多,所以我们加了clean,运行时清除之前生成的文件。在对应的文件夹下就可以看到测试报告了。

os.system("hrun testsuites/tags_suits.yml --alluredir=reports/temps --clean-alluredir")

# 生成文件需要时间,等待3秒

time.sleep(3)

# 生成allure报告

os.system("allure generate reports/temps -o reports/allure-report --clean")

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-03-05,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 自动化测试实战 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档