網站首頁 編程語言 正文
前言
- 前面介紹了Allure報告,本篇來學習普通的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: '測試報告']) } } }
查看報告
左側菜單列表,點擊測試報告
解決報告無樣式
- 官網說明: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
相關推薦
- 2022-03-30 詳解Python的條件語句_python
- 2022-07-29 python中open函數對文件處理的使用教程_python
- 2022-05-03 C#面向對象設計原則之單一職責原則_C#教程
- 2022-06-18 Android?ScrollView實現滾動超過邊界松手回彈_Android
- 2022-07-16 windows安全加固--關閉非必要端口
- 2022-12-21 C語言中continue的用法詳解_C 語言
- 2023-07-13 react中的useRef的使用
- 2022-07-27 Python中的re正則表達式模塊_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支