天天看点

pytest之allure报告1.安装allure2.pytest插件安装3.pytest生成allure测试报告的命令参数4.查看allure的测试报告命令高大尚装X的报告就出来了

allure官网文档:http://allure.qatools.ru/

只做测试报告 --可以与jenkins做继承 - 与pytest继承

不是pytest的一种框架 --独立于所有框架的一种命令行工具

1.安装allure

1.下载allure.zip:

官网 -> 2.Get Started -> 2.1.4. Manual installation (手动安装) -> 选一个最新的 -> 选.zip的下载

这里下载很慢,建议找个现有的

pytest之allure报告1.安装allure2.pytest插件安装3.pytest生成allure测试报告的命令参数4.查看allure的测试报告命令高大尚装X的报告就出来了

2.解压到本地目录,配置allure.bat的环境变量

path 下添加 D:\allure-2.13.2\bin

在命令行中运行allure,确认环境变量配置成功

2.pytest插件安装

与pytest集成:需要pytest执行用例后,生成allure能够解析的测试结果文件

官方文档 - 6.python - 6.1pytest - 6.1.1 installation

命令:pip install allure-pytest

3.pytest生成allure测试报告的命令参数

官方文档 - 6.python - 6.1pytest - 6.1.2 Usage

命令:–alluredir=/xxx/my_allure_results

此时生成的报告不好看

示例:

import pytest
pytest.main(["-s", "-v", "-m", "demo", "--html=Outputs/report/report.html",
             "--reruns", "2", "--reruns-delay", "5",
             "--alluredir=Outputs/allure_reports"])`
           

4.查看allure的测试报告命令

使用allure命令,生成html样式的报告

allure serve alluredir的相对路径 -路径写对 要不然页面会空白

pytest之allure报告1.安装allure2.pytest插件安装3.pytest生成allure测试报告的命令参数4.查看allure的测试报告命令高大尚装X的报告就出来了

高大尚装X的报告就出来了

pytest之allure报告1.安装allure2.pytest插件安装3.pytest生成allure测试报告的命令参数4.查看allure的测试报告命令高大尚装X的报告就出来了