Commit 599f8c77 599f8c77f4aa406f34dc6cc1166fad5f73624859 by chenjing

更新配置

1 parent c0b8d771
......@@ -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}环境] 有测试用例执行失败!"
}
}
}
......