pytest+allure
1.搭建allure环境:
前置条件:python、allure已经安装成功
allure的安装:
- allure包下载:https://github.com/allure-framework/allure2/releases
- 解压 -> 进入bin目录 -> 运行allure.bat,
- 把bin目录加入PATH环境变量


4.重启pycharm
然后安装allure-pytest:在cmd窗口输入 pip3 install allure-pytest
2.在python代码中添加allure注解:
@allure.epic("我的测试报告")
@allure.feature("环境搭建")
@allure.severity(allure.severity_level.TRIVIAL)
class TestDemo(object):
@allure.story("用例1")
@allure.description("demo1")
def test_demo1(self):
3.在代码目录中新建一个存放allure报告的包:

在pycharm Terminal窗口运行用例:
pytes-------------运行所有的用例
allure serve D:/work/pythonCode/interfaceAutoTest/allure-results -----生成报告

运行结果:


浙公网安备 33010602011771号