pytest-2:allure 的安裝、使用


版本對應:

python3.4==>allure-pytest2.7.0

python3.6==>allure0pytest2.8.6

 

環境安裝:

1.先安裝好對應的python,准備好pytest腳本

2.安裝allure-pytest

pip install allure-pytest==version(python適配的版本號)

3.下載allure命令行工具

github地址--可以下載最新版本:

https://github.com/allure-framework/allure2/releases

把解壓后的文件存放到一個目錄下

在path中添加環境變量

 

 

 在cmd命令窗口中輸入以下命令,出現版本號則可以執行下一步

allure --version

切換到pytest腳本目錄下,

執行存放allure報告的路徑命令:

pytest --alluredir ./report/allure_raw

cmd中運行報告:

allure serve report/allure_raw

 

 

========================================================================

要在allure報告上顯示內容的語法:

先在腳本中導入allure

# 在報告上顯示的模塊名
@allure.feature("===login===")
class TestLogin():
    # 在報告上顯示的用例名
    @allure.story("==test_login==")
# 禪道的bug的鏈接地址,在報告上可點擊進行跳轉
@allure.issue("url")
# 禪道的用例鏈接地址,在報告上可點擊進行跳轉
@allure.testcase("url")
def test_login(self): chrome_options = webdriver.ChromeOptions()

# 在報告上顯示的步驟名
@allure.step("==test_login==")

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM