參考資料:
安裝allure:https://www.jianshu.com/p/8c2a696090cd
安裝pytest:https://www.jianshu.com/p/8c2a696090cd
配置python virtualenv虛擬環境:https://www.jianshu.com/p/dc9501777225
pytest生成xml:https://www.jianshu.com/p/c5c9ad16b1bf
allure生成html報告:https://www.jianshu.com/p/7e3d0d7c3b38
直接使用命令行生成
allure generate ./reports/xml -o ./reports/html --clean
allure裝飾器匯總:https://www.jianshu.com/p/93235504ce7f
allure輸出報告的層級控制:https://www.jianshu.com/p/c92b936d65a2
allure tag標簽:https://www.jianshu.com/p/93665779d983
allure報告添加附件:https://www.jianshu.com/p/ce411e44499a
參考博客:https://www.cnblogs.com/xiaogongjin/p/11705134.html
這里以allure+pytest進行講解:
使用之前需要導入allure模塊
import allure
1、feature--測試用例主要功能模塊
使用pytest框架編寫用例時,一般一個py文件內的一個class就是屬於一個大模塊,如果想在報告內顯示單獨的模塊,在class類前使用方法@allure.feayure()方法



2、story——feature功能模塊下的分支功能,使用方法:@allure.story()


3、severity——測試用例的嚴重級別
Allure中對嚴重級別的定義:
-
-
blocker級別:中斷缺陷(客戶端程序無響應,無法執行下一步操作)
-
critical級別:臨界缺陷( 功能點缺失)
-
normal級別:普通缺陷(數值計算錯誤)
-
minor級別:次要缺陷(界面錯誤與UI需求不符)
-
trivial級別:輕微缺陷(必輸項無提示,或者提示不規范)
-
使用方法:@allure.severity(allure.severity_level.CRITICAL) 或者 @allure.severity('critical')


4、step——測試用例的步驟
使用方法:1.@allure.step() 只能以裝飾器的形式放在類或者方法上面 2.with allure.step(): 可以放在測試用例方法里面,但測試步驟的代碼需要被該語句包含


