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

Conversion Exception for NUnit2 XML Format when nunit-version is a String

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: xunit-plugin
    • Labels:
      None
    • Environment:
      xUnit Plugin 2.2.3
      jest-nunit-reporter 1.3.0
    • Similar Issues:

      Description

      This seems to be an incompatibility with https://github.com/kingatlas/jest-nunit-reporter which generates "na" as the nunit-version.

      As a result we get this conversion error:

      org.jenkinsci.plugins.xunit.service.TransformerException: Conversion error: Cannot convert string "" to a double
      	at org.jenkinsci.plugins.xunit.service.XUnitConversionService.convert(XUnitConversionService.java:81)
      	at org.jenkinsci.plugins.xunit.service.XUnitTransformerCallable.invoke(XUnitTransformerCallable.java:120)
      	at org.jenkinsci.plugins.xunit.service.XUnitTransformerCallable.invoke(XUnitTransformerCallable.java:39)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:208)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:360)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at hudson.remoting.Engine$1$1.run(Engine.java:98)
      	at java.lang.Thread.run(Thread.java:745)
      	at ......remote call to JNLP4-connect connection from 10.48.41.61/10.48.41.61:49693(Native Method)
      	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1654)
      	at hudson.remoting.UserResponse.retrieve(UserRequest.java:311)
      	at hudson.remoting.Channel.call(Channel.java:905)
      	at hudson.FilePath.act(FilePath.java:987)
      

      Root cause seems to be the nunit-version="na" attribute:

      <?xml version="1.0" encoding="UTF-8"?>
      <test-results name="jest results" date="2018-08-21" time="13:25:10" invalid="0" ignored="0" inconclusive="0" not-run="0" errors="0" total="1" failures="0" skipped="0">
        <environment nunit-version="na" clr-version="na" os-version="10.0.17134" platform="win32" cwd="C:\jenkins\workspace\y-AZJT2AES7D\src\foobar" user="na" user-domain="na" machine-name="DESKTOP-12345"/>
        <culture-info current-culture="na" current-uiculture="na"/>
        <test-suite name="Foo.Bar" time="1.987" executed="True" success="True" result="Success" type="TestFixture">
          <results>
            <test-case name="the foo is not a bar" executed="True" result="Success" time="0">
            </test-case>
          </results>
        </test-suite>
      </test-results>
      

      See attached report file

        Attachments

          Issue Links

            Activity

            Hide
            tknerr Torben Knerr added a comment -

            probably related to JENKINS-52107

            Show
            tknerr Torben Knerr added a comment - probably related to JENKINS-52107
            Hide
            nfalco Nikolas Falco added a comment -

            The nunit version must be a valid version because in XSLT there are logics on how construct the classname and name of test case. Depending on the version some attributes or xml elements are not present.

            Please fill a bug to the tools to declare against which version of NUnit is compatible.

            Show
            nfalco Nikolas Falco added a comment - The nunit version must be a valid version because in XSLT there are logics on how construct the classname and name of test case. Depending on the version some attributes or xml elements are not present. Please fill a bug to the tools to declare against which version of NUnit is compatible.
            Hide
            tknerr Torben Knerr added a comment -

            Nikolas Falco will do so, thanks!

            Regarding validity of version number: what is considered a valid "nunit-version"?

            I have seen digits only (e.g. "2.4.0.0") but also things like "<toolname> 2.6.0.0"

            Any recommendation on this?

            Show
            tknerr Torben Knerr added a comment - Nikolas Falco will do so, thanks! Regarding validity of version number: what is considered a valid "nunit-version"? I have seen digits only (e.g. "2.4.0.0") but also things like "<toolname> 2.6.0.0" Any recommendation on this?
            Hide
            nfalco Nikolas Falco added a comment -

            Depends on the NUnit version. The most recent writes only the version number with exception of NUnit 2.2 that does not have environment XML element. Remember that the version should be 2.x, if you see 3.x are adapter of NUnit 3.x to write in NUnit 2 format.

            Here you can find examples gathered from JIRA issues.

            Show
            nfalco Nikolas Falco added a comment - Depends on the NUnit version. The most recent writes only the version number with exception of NUnit 2.2 that does not have environment XML element. Remember that the version should be 2.x, if you see 3.x are adapter of NUnit 3.x to write in NUnit 2 format. Here you can find examples gathered from JIRA issues.
            Hide
            nfalco Nikolas Falco added a comment -

            Anyway in the github repo you linked above seems has used a specific XSD file. To know which is the correct version to write you should check which XSD version is that. You can find all NUnit XSD version to compare here (ignore the nunit-2.x.xsd file)

            Show
            nfalco Nikolas Falco added a comment - Anyway in the github repo you linked above seems has used a specific XSD file . To know which is the correct version to write you should check which XSD version is that. You can find all NUnit XSD version to compare here (ignore the nunit-2.x.xsd file)
            Hide
            nfalco Nikolas Falco added a comment -

            By a quick compare seems version 2.5 (or 2.6 since the XSD are the same)

            Show
            nfalco Nikolas Falco added a comment - By a quick compare seems version 2.5 (or 2.6 since the XSD are the same)
            Hide
            tknerr Torben Knerr added a comment -

            Thanks Nikolas Falco for pointing me to the XSD file, I totally missed that.

            Will create a PR in the jest-nunit-publisher repo with the version being properly set to 2.5.0.0.

            Show
            tknerr Torben Knerr added a comment - Thanks Nikolas Falco for pointing me to the XSD file, I totally missed that. Will create a PR in the jest-nunit-publisher repo with the version being properly set to 2.5.0.0.
            Hide
            tknerr Torben Knerr added a comment -
            Show
            tknerr Torben Knerr added a comment - See related PR here: https://github.com/kingatlas/jest-nunit-reporter/pull/3

              People

              • Assignee:
                nfalco Nikolas Falco
                Reporter:
                tknerr Torben Knerr
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: