在Jenkins管道中发布2个Xunit结果

时间:2018-01-23 14:03:14

标签: jenkins groovy

我试图在Jenkins的管道中发布2个Xunit结果

我的第一个发布测试结果运行良好。 为什么我的第二次测试结果不会导致我的构建失败? 在测试报告中,我看到了所有失败的测试(第二个和第一个)

对于检查测试状态,我尝试使用$ {currentBuild.result}和$ {currentBuild.currentResult}

我的管道:

 stage('Run Unit Tests') {
   build('UnitTests')
  }
  stage('Publish Test Result') {
   step([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode:
    2,
    thresholds: [
     [$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '0', unstableNewThreshold: '', unstableThreshold: ''],
     [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '0', unstableNewThreshold: '', unstableThreshold: '']
    ],
    tools: [
     [$class: 'XUnitDotNetTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: '\\**\\unittests-results.xml', skipNoTestFiles: false, stopProcessingIfError: true]
    ]
   ])
  }
  stage('Run Integration Tests') {
   build('IntegrationTests')
  }
  stage('Publish Integration Test Result') {
   step([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 2,
    thresholds: [
     [$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '0', unstableNewThreshold: '', unstableThreshold: ''],
     [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '0', unstableNewThreshold: '', unstableThreshold: '']
    ],
    tools: [
     [$class: 'XUnitDotNetTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: '\\**\\**\\integrationtests-results.xml', skipNoTestFiles: false, stopProcessingIfError: true]
    ]
   ])
  }       

0 个答案:

没有答案