allure-pytest生成测试报告,经过实践得出如下经验,参考了很多大神的博客一并附上

1、安装allure-pytest

pip install allure-pytest

2、执行命令生成json和txt文件:

pytest tests --alluredir report/allure_raw


pytest test_setupAndteardown --alluredir report/allure_raw

如果过程中报错AttributeError: module 'allure' has no attribute 'severity_level'则执行:
pip uninstall pytest-allure-adaptor
pip install allure-pytest

 

3、我们执行命令后拿到的是json和txt格式文件不是我们期望的可打开html图形界面

我们需要从官网下载最新allure 的zip文件,解压放置项目lib文件夹下

4、执行命令

allure generate <allure测试结果目录> -o <存放报告的目录> --clean

allure测试结果目录,是上面运行 pytest 命令后存放结果的地方,我们这里的目录是 report 下的 allure_raw 文件夹;

存放报告的目录,是最终生成的测试报告存放的目录,我打算把生成出的报告放在 report 下的 allure_report文件夹中;

--clean参数用来清空已有的报告,避免覆盖时出错。

 

python参考文档:

https://www.jianshu.com/p/54a88c8a8bc8?utm_campaign=hugo&utm_medium=reader_share&utm_content=note&utm_source=qq


--java参考地址:
https://blog.csdn.net/qq_39421886/article/details/99562698

posted on 2019-09-02 17:00  陌生初见  阅读(2456)  评论(2编辑  收藏  举报