【问题标题】:Control parameters for the Jenkins xUnit pluginJenkins xUnit 插件的控制参数
【发布时间】:2018-10-19 06:04:00
【问题描述】:

我有这个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 是什么意思? failureNewThresholdfailureThresholdunstableNewThresholdunstableThreshold 有什么区别?

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

【问题讨论】:

    标签: jenkins jenkins-plugins jenkins-pipeline xunit


    【解决方案1】:

    当您第一次为现有项目配置 xUnit 时,您不希望每次测试都总是成功。其中一些可能需要一些调整,特别是从 jenkins slave 运行时。

    由于您通常不希望在已知的遗留测试中将构建标记为 failedunstable,因此您可以指定预期会失败/跳过多少测试。

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

    参数

    thresholdmode ( str ) – 阈值是表示测试的绝对数量还是百分比。 “数字”或“百分比”。 (默认“数字”)

    thresholds ( list ) - “失败”和“跳过”测试的阈值。

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

      • 不稳定(整数)

      • unstablenew (int)

      • 失败(整数)

      • failurenew (int)

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

    关键字“new”让您设置是否授权添加新的失败测试,​​以及添加多少。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-31
      • 1970-01-01
      • 1970-01-01
      • 2017-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多