Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60532

Build fails, but all stages and steps show successful when using nunit plugin and the test file doesn't exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • nunit-plugin
    • None
    • Docker image jenkins/jenkins:2.208 in a docker network with a Perforce instance (https://github.com/p4paul/helix-docker) using p4-plugin 1.10.7, nunit-plugin 0.25, and blue-ocean 1.21

      When using the nunit-plugin, if the test result file is not found, the plugin reports 

      FATAL: No NUnit test report files were found. Configuration error?

      The stage is marked as failure, however the build continues with the next stage as if it were a success. At the end, the build is marked as failure.

      In Blue Ocean, all steps/stages are marked as success, but the build at the end is marked as a failure.

       

      I believe the expected result is that the error from nunit should act like any other error within a step and subsequent stages are skipped.

       

      Output with nunit-plugin with no existing file

       

      [Pipeline] stage
      [Pipeline] { (Build) (hide)
      [Pipeline] echo
      BUILD
      [Pipeline] nunit
      Recording NUnit tests results
      FATAL: No NUnit test report files were found. Configuration error?
      Post stage
      [Pipeline] echo
      Build Stage FAILURE
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Test)
      [Pipeline] echo
      TEST
      Post stage
      [Pipeline] echo
      Test Stage FAILURE
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Declarative: Post Actions)
      [Pipeline] echo
      Pipeline FAILURE
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: FAILURE
      

       

       

      Output with generic error (expected result)

       

      [Pipeline] stage (hide)
      [Pipeline] { (Build)
      [Pipeline] echo
      BUILD
      [Pipeline] error
      Post stage
      [Pipeline] echo
      Build Stage FAILURE
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Test)
      Stage "Test" skipped due to earlier failure(s)
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Declarative: Post Actions)
      [Pipeline] echo
      Pipeline FAILURE
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: ERROR
      Finished: FAILURE
      

       

      The following the the pipeline script used:

       

      pipeline
      {
          agent any
          stages
          {
              stage('Build')
              {
                  steps
                  {
                      echo "BUILD"
                      //error("ERROR")
                      nunit testResultsPattern: "**/nunit.xml"
                  }
                  post
                  {
                      success
                      {
                          echo "Build Stage SUCCESS"
                      }
                      failure
                      {
                          echo "Build Stage FAILURE"
                      }
                  }
              }
              stage('Test')
              {
                  steps
                  {
                      echo "TEST"				
                  }
                  post
                  {
                      success
                      {
                          echo "Test Stage SUCCESS"
                      }
                      failure
                      {
                          echo "Test Stage FAILURE"
                      }
                  }
              }
          }
          post
          {
              success
              {
                  echo "Pipeline SUCCESS"
              }
              failure
              {
                  echo "Pipeline FAILURE"
              }
          }
      }

       

       

        1. error-buildstage.PNG
          10 kB
          Matthew Brunton
        2. error-stages.PNG
          4 kB
          Matthew Brunton
        3. nunit-buildstage.PNG
          12 kB
          Matthew Brunton
        4. nunit-stages.PNG
          3 kB
          Matthew Brunton

            Unassigned Unassigned
            mbrunton27 Matthew Brunton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: