Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
chenjing
/
api-test
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
599f8c77
...
599f8c77f4aa406f34dc6cc1166fad5f73624859
authored
2026-01-21 17:15:59 +0800
by
chenjing
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新配置
1 parent
c0b8d771
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
5 deletions
Jenkinsfile
Jenkinsfile
View file @
599f8c7
...
...
@@ -75,7 +75,8 @@ pipeline {
steps {
echo "正在生成测试报告..."
sh '''
ls -la api_test_report_* 2>/dev/null || echo "未找到报告文件"
echo "查找报告文件..."
ls -lh reports/${DEPLOY_ENV}/ 2>/dev/null || echo "未找到报告文件"
'''
}
}
...
...
@@ -83,16 +84,42 @@ pipeline {
post {
always {
echo "清理工作目录..."
sh 'echo "测试执行完成"'
echo "正在收集测试结果..."
// 归档报告文件
archiveArtifacts artifacts: 'reports/**/*.{html,xlsx}',
allowEmptyArchive: true,
defaultExcludes: false
// 发布 HTML 报告到 Jenkins
script {
def reportDir = "reports/${env.DEPLOY_ENV}"
def htmlReports = sh(
script: "find ${reportDir} -maxdepth 1 -name '*.html' -type f | sort -r | head -1",
returnStdout: true
).trim()
if (htmlReports) {
echo "找到最新HTML报告: ${htmlReports}"
publishHTML([
reportDir: '.',
reportFiles: htmlReports,
reportName: "API Test Report (${env.DEPLOY_ENV})",
keepAll: true,
alwaysLinkToLastBuild: true
])
} else {
echo "未找到HTML报告文件"
}
}
}
success {
echo "
✅
[${DEPLOY_ENV}环境] 所有测试用例运行成功!"
echo "
[SUCCESS]
[${DEPLOY_ENV}环境] 所有测试用例运行成功!"
}
failure {
echo "
❌
[${DEPLOY_ENV}环境] 有测试用例执行失败!"
echo "
[FAILURE]
[${DEPLOY_ENV}环境] 有测试用例执行失败!"
}
}
}
...
...
Please
register
or
sign in
to post a comment