亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Jenkins使用publish?html?report插件展示HTML報告的方法

 更新時間:2022年03月16日 09:02:23   作者:愛學(xué)習(xí)de測試小白  
這篇文章主要介紹了Jenkins使用publish?html?report插件展示HTML報告的方法,展示普通的html如何展示在jenkins上,本文通過圖文并茂的形式給大家介紹的非常詳細,需要的朋友可以參考下

前言

  • 前面介紹了Allure報告,本篇來學(xué)習(xí)普通的HTML如何展示在Jenkins上

安裝插件

  • Manage Jenkins --> Manage Plugins --> 可選插件 --> 搜索 publish html repor
  • 說明:截圖中是已安裝好插件,所以在已安裝中

在這里插入圖片描述

準備測試代碼

  • 新建test_01.py,代碼如下
  • 安裝python包:pip install pytest-html
# -*- coding: utf-8 -*-
# @Time    : 2021/11/27
# @Author  : 大海
# @File    : test_40.py

import os
def test_add():
    c = 1 + 2
    assert c == 2
if __name__ == '__main__':
    os.system('pytest -s test_02.py --html=report.html --self-contained-html')

Pipeline

pipeline {
    agent any
    stages {
        stage('checkout code') {
            steps {
                checkout([$class: 'GitSCM', branches: [[name: '*/分支']], extensions: [], userRemoteConfigs: [[credentialsId: '認證信息', url: '你的倉庫地址']]])
            }
        }
        stage('auto test') {
            steps {
                bat 'python test_01.py'
            }
        }
    }
    post {
      always {
         // reportDir 報告所在目錄;reportFiles 報告名稱;reportName 在Jenkins菜單欄顯示的名稱 ;reportTitles 點進測試報告顯示的Title
         publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, keepAll: false, reportDir: './', reportFiles: 'report.html', reportName: '測試報告', reportTitles: '測試報告'])
      }
    }
}

查看報告

左側(cè)菜單列表,點擊測試報告

在這里插入圖片描述

在這里插入圖片描述

解決報告無樣式

在這里插入圖片描述

運行下面的腳本

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")

在這里插入圖片描述

shift +f5 刷新頁面多次(沒成功),可以清除瀏覽器歷史,再次進入就會有CSS樣式了

在這里插入圖片描述

到此這篇關(guān)于Jenkins使用publish html report插件展示HTML報告的文章就介紹到這了,更多相關(guān)Jenkins展示HTML報告內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論