title: Jenkins: Can I control how junit failures affect the build?
body: <p>I have a declarative pipeline, and I have two groups of tests:</p>
  <ul>
  <li>The failures from 1 group are actual warnings, and they must stop the build.</li>
  <li>Failures from the second group are only warnings: ideally I'd like the stage to fail, but the overall build status to remain successful.</li>
  </ul>
  <p>Simple version of my attempt at the warnings group. I have 2 steps:</p>
  <pre><code>steps {
      bat label: &quot;Compliance Test - Warnings&quot;, 
          script: &quot;${env.WARNTESTCMD} -report compliance_report.xml&quot; 
  
      catchError(buildResult: hudson.model.Result.SUCCESS, stageResult: hudson.model.Result.FAILURE) {
          junit testResults: 'compliance_report.xml', 
                allowEmptyResults: true
      }
  }
  </code></pre>
  <p>I've tried using catchError to give me the result I want, but no dice. The status of the build is set to UNSTABLE, and I don't seem to have any say in that.</p>
  <p>I guess the first thing I should ask is whether that's possible at all in Jenkins? Can I keeping my test results in junit format to be recognised by Jenkins as tests, or do I need to store them as artefacts but not official tests?</p>