欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Jenkins使用publish?html?report插件展示HTML報(bào)告的方法

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

前言

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

安裝插件

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

在這里插入圖片描述

準(zhǔn)備測(cè)試代碼

  • 新建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: '認(rèn)證信息', url: '你的倉(cāng)庫(kù)地址']]])
            }
        }
        stage('auto test') {
            steps {
                bat 'python test_01.py'
            }
        }
    }
    post {
      always {
         // reportDir 報(bào)告所在目錄;reportFiles 報(bào)告名稱;reportName 在Jenkins菜單欄顯示的名稱 ;reportTitles 點(diǎn)進(jìn)測(cè)試報(bào)告顯示的Title
         publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, keepAll: false, reportDir: './', reportFiles: 'report.html', reportName: '測(cè)試報(bào)告', reportTitles: '測(cè)試報(bào)告'])
      }
    }
}

查看報(bào)告

左側(cè)菜單列表,點(diǎn)擊測(cè)試報(bào)告

在這里插入圖片描述

在這里插入圖片描述

解決報(bào)告無(wú)樣式

在這里插入圖片描述

運(yùn)行下面的腳本

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

在這里插入圖片描述

shift +f5 刷新頁(yè)面多次(沒(méi)成功),可以清除瀏覽器歷史,再次進(jìn)入就會(huì)有CSS樣式了

在這里插入圖片描述

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

相關(guān)文章

最新評(píng)論