node("Jenkinsfile"){
stage("0-自动拉取测试代码"){
echo "0-自动拉取测试代码"
checkout scm //自动下载测试代码
}
stage("1-接口自动化测试"){
echo "1-执行接口自动化"
bat "pytest test_case/api -vs --alluredir=outFiles/report"
}
stage("2-UI自动化测试"){
echo "2-执行ui自动化"
bat "pytest test_case/web -vs --alluredir=outFiles/report"
}
stage("3-生成测试报告"){
echo "3-生成测试报告"
allure results: [[path: 'outFiles/report']]
}
stage("4-发送邮件"){
echo "4-发送邮件"
//读取邮件模板
def email_content=readFile encoding: 'utf-8', file: 'email_template.html'
emailext body: "${email_content}", subject: '${BUILD_STATUS} - ${PROJECT_NAME} - Build # ${BUILD_NUMBER}', to: 'xxxx@qq.com'
}
}
Jenkinsfile流水线代码模板
于 2023-03-12 13:09:17 首次发布