美文网首页
pytest与Allure2 输出测试报告

pytest与Allure2 输出测试报告

作者: Looo990 | 来源:发表于2020-05-10 14:14 被阅读0次

1、首先如果你没有安装 pytest 库的话,先使用 pip 安装一下:

    pip install pytest

2、另外还需要安装 pytest 支持 allure 报告的插件库:

    pip install allure-pytest

3、接下来在运行测试时,使用 pytest 命令运行:

    pytest <测试目录> --alluredir <测试结果存放目录>

-- pytest test_case --alluredir raw

- test_case:为测试用例存放目录,告诉 pytest 应该去哪里找用例;

- raw:是存放测试报告的,allure 收集 pytest 运行后产出的结果放在 raw 文件夹中。

4、下载allure的压缩包:https://github.com/allure-framework/allure2/releases

- 解压后将文件夹放到项目根目录下:

- 将 allure-2.13.1\bin所在的全目录,加入到系统环境变量path中

5 产出报告

    cd allure-2.13.1\bin

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

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

-右键index.html文件,通过浏览器打开

结果展示:

相关文章

网友评论

      本文标题:pytest与Allure2 输出测试报告

      本文链接:https://www.haomeiwen.com/subject/grdunhtx.html