在mac下使用allure 生成測試報告,需要安裝軟件為:
1. pytest
2. allure-pytest 或者 pytest-allure-adaptor (記住二者只能選其一)
3. allure(依賴jdk環境1.8+) (https://github.com/allure-framework/allure2/releases)
使用Pycharm 生成allure 樣式的測試報告,執行為:
pytest.main(['-s','-q','./test_login_case.py','--alluredir','../testresults/report/xml'])
os.system("allure generate ../testresults/report/xml -o ../testresults/report/html ")
4. 執行allure generate 遇到的問題:
mac 系統下執行的是.zshrc中的環境配置,因此添加環境配置為:
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin (此行不添加會報錯: sh allure: command not found)
export PATH=${PATH}:/Users/xxx/allure-2.13.2/bin