我正在使用cobertura在阶段的发布部分中从xml文件发布覆盖率报告。我还想获得覆盖率百分比,并在帖子部分的邮件中发送。
stage (publish){
steps{
......
}
post {
success {
publishCoverage adapters: [coberturaAdapter(path: 'coverage-dir/coverage.xml',
thresholds: [[failUnhealthy: true, thresholdTarget: 'Line', unhealthyThreshold: 90.0]])],
failNoReports: true, failUnhealthy: true,
globalThresholds: [[failUnhealthy: true, thresholdTarget: 'Aggregated Report', unhealthyThreshold: 90.0]],
sourceFileResolver: sourceFiles('NEVER_STORE')
}
}
}
post {
success {
mail to:"...",
subject:"SUCCESS",
body: "Coverage percentage of test is ${Percentage}"
}
failure {
mail to:"...",
subject:"SUCCESS",
body: "Coverage percentage of test is ${Percentage}"
}
}
我想在发布报告后在帖子部分添加一些内容,以获取覆盖率百分比并将其存储在变量中。 可以这样做吗?