Jenkins xUnit 插件的控制参数



我有这个Jenkinsfile,我使用xUnit插件。我想了解此文件中使用的关键字:

node{
stage ('Checkout')
{
checkout scm
}
stage ('Build')
{
try {
sh '''
mvn clean -B org.jacoco:jacoco-maven-plugin:prepare-agent install
'''
} catch (err) {
// do nothing
} finally {
//step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
step([$class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1,
thresholds: [
[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '1'],
[$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']],
tools: [
[$class: 'JUnitType', deleteOutputFiles: false, failIfNotNew: false, pattern: '**/target/surefire-reports/TEST-*.xml', skipNoTestFiles: true, stopProcessingIfError: false]]
])
}
}
}

SkippedThreshold是什么意思?failureNewThresholdfailureThreshold以及unstableNewThresholdunstableThreshold有什么区别?

感谢您帮助我理解这一点,我找不到清晰的文档。希望这对其他人有所帮助。

首次为现有项目配置 xUnit 时,您不希望每个测试都始终成功。其中一些可能需要一些调整,特别是当从 Jenkins 奴隶运行时。

由于通常不希望将生成标记为已知旧测试的failedunstable,因此可以指定预期失败/跳过的测试量。

您有文档中解释的配置: https://media.readthedocs.org/pdf/jenkins-job-builder/latest/jenkins-job-builder.pdf

参数:

阈值模式( str ( – 阈值是表示测试的绝对数还是百分比。"数字"或"百分比"。 (默认"数字"(

阈值(列表(– "失败"和"跳过"测试的阈值。

  • 要设置的阈值 (dict( 阈值,如果缺少,xUnit 应默认为内部值 0。每个测试阈值应 包含以下内容:

    • 不稳定(整数(

    • 不稳定新 (int(

    • 故障(整数(

    • 失败新 (int(

failureThresholdunstableThreshold之间的区别在于,在将构建设置为 FAILED 或 UNSTABLE 之前,您允许多少次测试失败。

关键字"new"允许您设置是否授权添加新的失败测试,

以及有多少。

最新更新