1. 程式人生 > 實用技巧 >pytest+allure生成測試報告開啟allure報告資料為NaN%的解決方法

pytest+allure生成測試報告開啟allure報告資料為NaN%的解決方法

問題:pytest+allure生成測試報告開啟allure報告資料為NaN%

1)直接在指令碼中執行乘車allure報告的命令:

os.system('allure generate report/report_data -o report/html --clean')
os.system('allure serve report/report_data')

2)在pycharm中找到index.html右擊open in Browser,開啟allure的測試報告出現數據為NaN%

3)pytest+allure生成測試報告開啟allure報告資料為NaN%的解決方法

①在本地的cmd或者pycharm中控制檯的下方點選“Terminal”進入命令列:

②進入執行指令碼所在的根目錄(如:test/test1/test_01.py,則進入test目錄即可),輸入命令:

#allure generate report/report_data -o report/html --clean 
生成測試報告,將json檔案生成報告儲存在指定目錄(report/html)下
allure generate測試結果資料所在目錄 -o測試報告儲存的目錄 --clean
--clean目的是先清空測試報告目錄,再生成新的測試報告

③進入執行指令碼所在的根目錄(如:test/test1/test_01.py,則進入test目錄即可),輸入命令:

#allure serve report/report_data   開啟測試報告