Allure測試報告怎麼設置

Allure 測試報告環境搭建

allure 的測試報告是老闆喜歡的樣子。如果能用上 allure,幹嘛還選擇其他的測試報告類型呢?python 的 pytest 單元測試框架有 allure 的插件,可以很方便的在 python 自動化測試過程中使用 allure 測試報告。

image-20220715172101290

1、Allure 安裝依賴

  • Java8 +, JDK1.8+
  • 下載 allure 安裝包
  • 配置環境變量
  • python 庫 pytest-allure

2、安裝 Java 的 JDK

  • 下載 Java 的 JDK

    如果安裝了 Jenkins, 可以用 Jenkins 的 Java 環境,通常在 Jenkins 安裝目錄下的 jre/bin 目錄下。

  • 在 window 平臺下運行

image-20220715172212394

更改並記住安裝的路徑:

image-20220715172221951

配置環境變量。在我的電腦裏界面右擊,點擊屬性,選擇高級系統設置:

image-20220715172231394

點擊環境變量:

image-20220715172240379

配置環境變量:

image-20220715172851104

cmd 命令判斷 sdk 是否安裝成功:

image-20220715172249679

3、安裝 allure

image-20220715172258819

cmd 輸入命令 allure 判斷是否安裝成功:

image-20220715172308507

4、安裝 pytest allure

pip install allure-pytest

生成測試報告:

pytest -s -q --alluredir report/allure/path

查看 allure,這一步會開啓對應的 allure 服務,可以在瀏覽器上查看已經生成的測試報告:

allure serve report\allure

5、在 Jenkins 上配置 Allure

  • 在 Jenkins 的插件市場安裝 Allure 插件;
  • 在 Jenkins 全局工具配置中配置 Allure 命令行。

  • 項目中配置 Allure 報告路徑。

現在 Jenkins 上會多一個 allure 的圖標:

image-20220715172326576

構建以後會有歷史記錄出現:

image-20220715172335785

190511


我是九柄,公衆號【 九柄 】,分享軟件測試文章、面試、教程資料,歡迎來看看。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章