1. 程式人生 > 其它 >Allure+jenkins配置

Allure+jenkins配置

Allure+jenkins配置
http://plugincompat.herokuapp.com/
https://docs.pytest.org/en/latest/reference.html#ini-options-ref
1、Allure 的使用
1、下載Allure:

# 下載 Allure,進行解壓
https://github.com/allure-framework/allure2/releases

2、新增環境變數
將解壓之後的路徑放到環境變數當中
3、安裝依賴包
https://pypi.org/project/allure-pytest/

pip install allure-pytest

4、執行測試,生成報告

pytest --alluredir=allure_report/

5、檢視allure報告
啟動allure

# 命令終端:輸入命令,啟動allure
allure serve 檔案路徑

2、無頭瀏覽器執行模式
1、可能需要配置

# 設定無頭瀏覽器
from selenium.webdriver import ChromeOptions
chrome_options = ChromeOptions()
# 設定為無頭模式(必須寫)
chrome_options.add_argument('--headless')
# 禁用GPU(可選)
chrome_options.add_argument('--disable-gpu')
# 非沙箱環境(可選)
chrome_options.add_argument('--no-sandbox')
# 建立drievr物件
driver = Chrome(options=chrome_options)

3、jenkins整合Allure
1、安裝 Jenkins 的 Allure 外掛;



4、jenkins分散式配置
Master-Slave:主從模式