網(wǎng)站首頁 編程語言 正文
前言
- 前面介紹了Allure報告,本篇來學(xué)習(xí)普通的HTML如何展示在Jenkins上
安裝插件
- Manage Jenkins --> Manage Plugins --> 可選插件 --> 搜索 publish html repor
- 說明:截圖中是已安裝好插件,所以在已安裝中
準(zhǔn)備測試代碼
- 新建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: '你的倉庫地址']]]) } } 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è)菜單列表,點擊測試報告
解決報告無樣式
- 官網(wǎng)說明:https://www.jenkins.io/doc/book/security/configuring-content-security-policy/
- 點擊 Mange Jenkins 頁面,找到Script Console
運行下面的腳本
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
shift +f5 刷新頁面多次(沒成功),可以清除瀏覽器歷史,再次進入就會有CSS樣式了
原文鏈接:https://blog.csdn.net/IT_heima/article/details/123513085
相關(guān)推薦
- 2022-09-03 Go實現(xiàn)替換(覆蓋)文件某一行內(nèi)容的示例代碼_Golang
- 2021-11-27 Centos7.9搭建自主郵件服務(wù)器詳細步驟_Linux
- 2022-05-02 關(guān)于Nginx中虛擬主機的一些冷門知識小結(jié)_nginx
- 2022-05-20 Springboot讀取application配置文件中的自定義配置的幾種方式
- 2023-06-03 React實現(xiàn)一個倒計時hook組件實戰(zhàn)示例_React
- 2023-01-11 Rust結(jié)構(gòu)體的定義與實例化詳細講解_Rust語言
- 2022-04-28 C++實現(xiàn)簡單班級成績管理系統(tǒng)_C 語言
- 2022-08-30 MongoDB數(shù)據(jù)庫權(quán)限管理詳解_MongoDB
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支