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

Nunit plugin in raises exception if there are no tests in nunit xml

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: nunit-plugin
    • Labels:
      None
    • Environment:
      nunit 0.17, jenkins 1.651.1
    • Similar Issues:

      Description

      I recently upgraded jenkins and all our plugins and some of our builds are failing.

      After investigation it turns out that we produce some nunit test xml files that have no test results in (we might have set a test to [Ignore] temporarily for example).

      These used to work, and now do not.

      Example xml:

      <?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="RES.Coordinate.Calculation.Test.TurkeyTest" skipped="1" tests="1" time="">
      <testcase classname="RES.Coordinate.Calculation.Test.TurkeyTest" name="ED1950_to_WGS84("T1",556351,4611739,27.67626007d,41.65371627d)">
      <skipped message=""/>
      </testcase>
      </testsuite>

      The output is as follows:

      Recording NUnit tests results
      ERROR: Step ‘Publish NUnit test result report’ aborted due to exception:
      java.io.IOException: Failed to read D:\EX00_WS\temporary-junit-reports\TEST-RES.Coordinate.Calculation.Test.TurkeyTest_2.xml
      at hudson.tasks.junit.TestResult.parse(TestResult.java:306)
      at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:175)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:154)
      at hudson.tasks.junit.TestResult.<init>(TestResult.java:126)
      at hudson.plugins.nunit.NUnitPublisher$1.invoke(NUnitPublisher.java:202)
      at hudson.plugins.nunit.NUnitPublisher$1.invoke(NUnitPublisher.java:191)
      at hudson.FilePath.act(FilePath.java:990)
      at hudson.FilePath.act(FilePath.java:968)
      at hudson.plugins.nunit.NUnitPublisher.getTestResult(NUnitPublisher.java:191)
      at hudson.plugins.nunit.NUnitPublisher.recordTestResult(NUnitPublisher.java:147)
      at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:109)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
      at hudson.model.Build$BuildExecution.post2(Build.java:185)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
      at hudson.model.Run.execute(Run.java:1763)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:410)
      Caused by: java.lang.NumberFormatException: empty String
      at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
      at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
      at java.lang.Float.parseFloat(Unknown Source)
      at hudson.tasks.junit.SuiteResult.<init>(SuiteResult.java:170)
      at hudson.tasks.junit.SuiteResult.parseSuite(SuiteResult.java:144)
      at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:129)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:301)
      ... 20 more
      Build result "FAILURE". Skipping script.

      Cheers

      Cedd

        Attachments

          Activity

          cedd cedd burge created issue -
          Hide
          daflame Jeremy Wilkins added a comment -

          I am also encountering this issue. It seems to happen when all the tests in a test fixture are marked as ignored for me as well.

          Show
          daflame Jeremy Wilkins added a comment - I am also encountering this issue. It seems to happen when all the tests in a test fixture are marked as ignored for me as well.
          Hide
          nikitaignatov Nikita Ignatov added a comment -

          I experience the same issue with any tests that are marked with ignore attribute.

          ERROR: Step ‘Publish NUnit test result report’ aborted due to exception:
          java.io.IOException: Failed to read T:\workspace\project\temporary-junit-reports\TEST-testcase.xml
          at hudson.tasks.junit.TestResult.parse(TestResult.java:306)
          at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244)
          at hudson.tasks.junit.TestResult.parse(TestResult.java:175)
          at hudson.tasks.junit.TestResult.parse(TestResult.java:154)
          at hudson.tasks.junit.TestResult.<init>(TestResult.java:126)
          at hudson.plugins.nunit.NUnitPublisher$1.invoke(NUnitPublisher.java:243)
          at hudson.plugins.nunit.NUnitPublisher$1.invoke(NUnitPublisher.java:226)
          at hudson.FilePath.act(FilePath.java:990)
          at hudson.FilePath.act(FilePath.java:968)
          at hudson.plugins.nunit.NUnitPublisher.getTestResult(NUnitPublisher.java:226)
          at hudson.plugins.nunit.NUnitPublisher.recordTestResult(NUnitPublisher.java:189)
          at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:152)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
          at hudson.model.Build$BuildExecution.post2(Build.java:185)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
          at hudson.model.Run.execute(Run.java:1763)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:410)
          Caused by: java.lang.NumberFormatException: empty String
          at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
          at java.lang.Float.parseFloat(Unknown Source)
          at hudson.tasks.junit.SuiteResult.<init>(SuiteResult.java:170)
          at hudson.tasks.junit.SuiteResult.parseSuite(SuiteResult.java:144)
          at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:129)
          at hudson.tasks.junit.TestResult.parse(TestResult.java:301)
          ... 20 more

          Show
          nikitaignatov Nikita Ignatov added a comment - I experience the same issue with any tests that are marked with ignore attribute. ERROR: Step ‘Publish NUnit test result report’ aborted due to exception: java.io.IOException: Failed to read T:\workspace\project\temporary-junit-reports\TEST-testcase.xml at hudson.tasks.junit.TestResult.parse(TestResult.java:306) at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244) at hudson.tasks.junit.TestResult.parse(TestResult.java:175) at hudson.tasks.junit.TestResult.parse(TestResult.java:154) at hudson.tasks.junit.TestResult.<init>(TestResult.java:126) at hudson.plugins.nunit.NUnitPublisher$1.invoke(NUnitPublisher.java:243) at hudson.plugins.nunit.NUnitPublisher$1.invoke(NUnitPublisher.java:226) at hudson.FilePath.act(FilePath.java:990) at hudson.FilePath.act(FilePath.java:968) at hudson.plugins.nunit.NUnitPublisher.getTestResult(NUnitPublisher.java:226) at hudson.plugins.nunit.NUnitPublisher.recordTestResult(NUnitPublisher.java:189) at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:152) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668) at hudson.model.Run.execute(Run.java:1763) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Caused by: java.lang.NumberFormatException: empty String at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at java.lang.Float.parseFloat(Unknown Source) at hudson.tasks.junit.SuiteResult.<init>(SuiteResult.java:170) at hudson.tasks.junit.SuiteResult.parseSuite(SuiteResult.java:144) at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:129) at hudson.tasks.junit.TestResult.parse(TestResult.java:301) ... 20 more
          rtyler R. Tyler Croy made changes -
          Field Original Value New Value
          Workflow JNJira [ 170569 ] JNJira + In-Review [ 183959 ]
          Hide
          slide_o_mix Alex Earl added a comment -

          Can someone please upload an nunit xml file that causes this issue?

          Show
          slide_o_mix Alex Earl added a comment - Can someone please upload an nunit xml file that causes this issue?
          slide_o_mix Alex Earl made changes -
          Assignee Bruno P. Kinoshita [ kinow ] Alex Earl [ slide_o_mix ]
          Hide
          slide_o_mix Alex Earl added a comment -

          After looking at this again, it looks like the XML is badly formed:

           

          <?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="RES.Coordinate.Calculation.Test.TurkeyTest" skipped="1" tests="1" time="">
          <testcase classname="RES.Coordinate.Calculation.Test.TurkeyTest" name="ED1950_to_WGS84("T1",556351,4611739,27.67626007d,41.65371627d)">
          <skipped message=""/>
          </testcase>
          </testsuite>

           

          If you look at the name attribute of the testcase, there are quotes inside quotes "T1", which is not allowed. They either need to be escaped as XML entities (") or single quotes need to be used.

          I need additional XML's from other folks to look into their issues,

          Show
          slide_o_mix Alex Earl added a comment - After looking at this again, it looks like the XML is badly formed:   <?xml version= "1.0" encoding= "UTF-8" ?><testsuite errors= "0" failures= "0" name= "RES.Coordinate.Calculation.Test.TurkeyTest" skipped= "1" tests= "1" time=""> <testcase classname= "RES.Coordinate.Calculation.Test.TurkeyTest" name= "ED1950_to_WGS84(" T1 ",556351,4611739,27.67626007d,41.65371627d)" > <skipped message=""/> </testcase> </testsuite>   If you look at the name attribute of the testcase, there are quotes inside quotes "T1", which is not allowed. They either need to be escaped as XML entities (") or single quotes need to be used. I need additional XML's from other folks to look into their issues,
          Hide
          slide_o_mix Alex Earl added a comment -

          Also, please make sure that you don't set fail if no results. 

          Show
          slide_o_mix Alex Earl added a comment - Also, please make sure that you don't set fail if no results. 
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Earl
          Path:
          pom.xml
          src/main/java/hudson/plugins/nunit/NUnitArchiver.java
          src/main/java/hudson/plugins/nunit/NUnitPublisher.java
          src/main/java/hudson/plugins/nunit/NUnitReportTransformer.java
          src/main/resources/hudson/plugins/nunit/NUnitPublisher/config.jelly
          src/main/resources/index.jelly
          src/test/java/hudson/plugins/nunit/NUnitArchiverTest.java
          src/test/java/hudson/plugins/nunit/NUnitIntegrationTest.java
          src/test/java/hudson/plugins/nunit/NUnitPublisherTest.java
          src/test/java/hudson/plugins/nunit/NUnitReportTransformerTest.java
          src/test/java/hudson/plugins/nunit/NUnitToJUnitXslTest.java
          src/test/resources/hudson/plugins/nunit/NUnit-issue34452.xml
          http://jenkins-ci.org/commit/nunit-plugin/5bd699cedeae13475a3321637da3d5c47397b362
          Log:
          Fix JENKINS-27618, JENKINS-27906, JENKINS-34452, JENKINS-42967

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: pom.xml src/main/java/hudson/plugins/nunit/NUnitArchiver.java src/main/java/hudson/plugins/nunit/NUnitPublisher.java src/main/java/hudson/plugins/nunit/NUnitReportTransformer.java src/main/resources/hudson/plugins/nunit/NUnitPublisher/config.jelly src/main/resources/index.jelly src/test/java/hudson/plugins/nunit/NUnitArchiverTest.java src/test/java/hudson/plugins/nunit/NUnitIntegrationTest.java src/test/java/hudson/plugins/nunit/NUnitPublisherTest.java src/test/java/hudson/plugins/nunit/NUnitReportTransformerTest.java src/test/java/hudson/plugins/nunit/NUnitToJUnitXslTest.java src/test/resources/hudson/plugins/nunit/NUnit-issue34452.xml http://jenkins-ci.org/commit/nunit-plugin/5bd699cedeae13475a3321637da3d5c47397b362 Log: Fix JENKINS-27618 , JENKINS-27906 , JENKINS-34452 , JENKINS-42967
          Hide
          slide_o_mix Alex Earl added a comment -

          Will be fixed in 0.19

          Show
          slide_o_mix Alex Earl added a comment - Will be fixed in 0.19
          slide_o_mix Alex Earl made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              cedd cedd burge
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: