import pytest,os,allure class Test2: def test_demo(self): assert 1 == 1 if __name__=='__main__':# 在当前模块执行 # 设置 Allure 报告的生成路径和保存路径 result_dir = "./result" report_dir = "./report" # pytest.main(['-s','test_demo.py::Test2::test_demo','--alluredir', {result_dir}]) pytest.main(['-s', 'test_demo.py', '--alluredir=reports']) # 使用命令行命令生成 Allure 报告 cmd = 'allure generate ./reports -o ./res' os.system(cmd)
标签:__,测试报告,demo,pytest,生成,allure,result,test From: https://www.cnblogs.com/haha1988/p/17569462.html