pytest使用allure生成测试报告的2种命令

pytest中使用allure生成测试报告有两种命令方式:

1.第一种(推荐):

第一步:输入下面的命令,执行pytest生成allure的json结果文件:

pytest test_cals.py --alluredir ./report

第二步:输入下面的命令生成html文件并启动一个服务,通过访问链接浏览html报告:

allure serve ./report

  

2.第二种:

第一步:输入下面的命令,执行pytest生成allure的json结果文件:

pytest test_cals.py --alluredir ./report

第二步:生成html文件,文件存放路径为【./allure-report/】

allure generate ./report/

第三步:启动一个服务,通过访问链接浏览html报告:

allure open ./allure-report/

总结:使用第一种,命令断,而且两个命令的报告文件路径保持一样

第二种可以看到其中allure open的后面的html文件路径和allure json路径不一致,容易搞混

原文地址:https://www.cnblogs.com/lybolg/p/13972047.html