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路徑不一致,容易搞混