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

xUnit plugin fails to parse simple xml output from unittest++

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Won't Fix
    • Component/s: xunit-plugin
    • Labels:
      None
    • Environment:
      windows, linux, hudson 1.381, xUnit 1.11, unittest++ 1.4
    • Similar Issues:

      Description

      c++ code:
      SUITE( MyTestSuite )
      {
      bool MyFun()

      { return false; }

      TEST( TestSomeStuff )

      { CHECK( MyFun() ); CHECK( MyFun() ); }

      }

      produces this xml file:
      <?xml version="1.0"?>
      <unittest-results tests="1" failedtests="1" failures="2" time="0">
      <test suite="MyTestSuite" name="TestSomeStuff" time="0">
      <failure message="/data/test.cpp(14) : MyFun()"/>
      <failure message="/data/test.cpp(15) : MyFun()"/>
      </test>
      </unittest-results>

      reported error:
      [xUnit] [ERROR] - At line 5 of file:/d:/.hudson/jobs/***/UnitTest/TEST--615512892.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'failure'. One of '

      {system-out, system-err}

      ' is expected.
      [xUnit] [WARNING] - The converted file for the result file 'd:\.hudson\jobs***\test_vcproj2cmake_testresults.xml' (during conversion process for the metric 'UnitTest-1.4 (default)') is not valid. The report file has been skipped.

      however, removing one line makes it work:
      <?xml version="1.0"?>
      <unittest-results tests="1" failedtests="1" failures="1" time="0">
      <test suite="MyTestSuite" name="TestSomeStuff" time="0">
      <failure message="/data/test.cpp(14) : MyFun()"/>
      </test>
      </unittest-results>

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : gbois
          Path:
          trunk/hudson/dtkit/dtkit-default/dtkit-default-junit/src/test/java/com/thalesgroup/dtkit/junit/UnitTestTest.java
          trunk/hudson/dtkit/dtkit-default/dtkit-default-junit/src/test/resources/com/thalesgroup/dtkit/junit/unitTest++/testcase2/junit-result.xml
          trunk/hudson/dtkit/dtkit-default/dtkit-default-junit/src/test/resources/com/thalesgroup/dtkit/junit/unitTest++/testcase2/result.xml
          trunk/hudson/dtkit/dtkit-default/pom.xml
          trunk/hudson/dtkit/dtkit-format/dtkit-junit-model/src/main/resources/com/thalesgroup/dtkit/junit/model/xsd/junit-1.0.xsd
          trunk/hudson/dtkit/dtkit-metrics-default-parent/pom.xml
          http://jenkins-ci.org/commit/36698
          Log:
          Start to fix JENKINS-8003.
          First step: Fixed in DTKIT/xUnit
          The next step is to raise an issue in Hudson core for the fact
          that Hudson can store/display 2failure elements
          <testcase classname="MyTestSuite" name="TestSomeStuff" time="0">
          <failure message="/data/test.cpp(14) : MyFun()" />
          <failure message="/data/test.cpp(15) : MyFun()" />
          </testcase>

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : gbois Path: trunk/hudson/dtkit/dtkit-default/dtkit-default-junit/src/test/java/com/thalesgroup/dtkit/junit/UnitTestTest.java trunk/hudson/dtkit/dtkit-default/dtkit-default-junit/src/test/resources/com/thalesgroup/dtkit/junit/unitTest++/testcase2/junit-result.xml trunk/hudson/dtkit/dtkit-default/dtkit-default-junit/src/test/resources/com/thalesgroup/dtkit/junit/unitTest++/testcase2/result.xml trunk/hudson/dtkit/dtkit-default/pom.xml trunk/hudson/dtkit/dtkit-format/dtkit-junit-model/src/main/resources/com/thalesgroup/dtkit/junit/model/xsd/junit-1.0.xsd trunk/hudson/dtkit/dtkit-metrics-default-parent/pom.xml http://jenkins-ci.org/commit/36698 Log: Start to fix JENKINS-8003 . First step: Fixed in DTKIT/xUnit The next step is to raise an issue in Hudson core for the fact that Hudson can store/display 2failure elements <testcase classname="MyTestSuite" name="TestSomeStuff" time="0"> <failure message="/data/test.cpp(14) : MyFun()" /> <failure message="/data/test.cpp(15) : MyFun()" /> </testcase>
          Hide
          gbois Gregory Boissinot added a comment -

          Despite the non display of the two failures in the testcase, does it suit you.
          Available in xUnit 1.14+ (built for Jenkins 1.396)

          Show
          gbois Gregory Boissinot added a comment - Despite the non display of the two failures in the testcase, does it suit you. Available in xUnit 1.14+ (built for Jenkins 1.396)
          Hide
          gbois Gregory Boissinot added a comment -

          There is now xUnit 1.15.
          Have you ever test with the new modifications?
          Does it suits you?

          Show
          gbois Gregory Boissinot added a comment - There is now xUnit 1.15. Have you ever test with the new modifications? Does it suits you?
          Hide
          apostasia apostasia added a comment -

          sorry for the late reply.
          I tried with xUnit 1.15, and the same file as above (ie make a new job that does nothing but collect a single xml file:)

          <?xml version="1.0" encoding="UTF-8"?>
          <testsuite errors="1" failures="2" tests="1" name="unittest">
            <testcase classname="MyTestSuite" name="TestSomeStuff" time="0">
                <failure message="/data/test.cpp(14) : MyFun()"/>
                <failure message="/data/test.cpp(25) : MyFun()"/>
             </testcase>
          </testsuite>
          

          I do not get an error anymore, but the results only report 1 test error instead of the expected 2.

          Show
          apostasia apostasia added a comment - sorry for the late reply. I tried with xUnit 1.15, and the same file as above (ie make a new job that does nothing but collect a single xml file: ) <?xml version="1.0" encoding="UTF-8"?> <testsuite errors="1" failures="2" tests="1" name="unittest"> <testcase classname="MyTestSuite" name="TestSomeStuff" time="0"> <failure message="/data/test.cpp(14) : MyFun()"/> <failure message="/data/test.cpp(25) : MyFun()"/> </testcase> </testsuite> I do not get an error anymore, but the results only report 1 test error instead of the expected 2.
          Hide
          gbois Gregory Boissinot added a comment -

          Yes, it the expected behaviour at the moment.
          I changed the JUnit XSD for accepting this kind of result.
          Therefore, you don't have any errors anymore.
          Nevertheless, in the Jenkins dashboard, only one failure is displayed.
          I have now to make a change in Jenkins core for displaying more than one failure.

          Show
          gbois Gregory Boissinot added a comment - Yes, it the expected behaviour at the moment. I changed the JUnit XSD for accepting this kind of result. Therefore, you don't have any errors anymore. Nevertheless, in the Jenkins dashboard, only one failure is displayed. I have now to make a change in Jenkins core for displaying more than one failure.
          Hide
          gbois Gregory Boissinot added a comment -

          Unfortunately, it is not possible to provide this kind of feature in the Jenkins core

          Show
          gbois Gregory Boissinot added a comment - Unfortunately, it is not possible to provide this kind of feature in the Jenkins core

            People

            Assignee:
            gbois Gregory Boissinot
            Reporter:
            apostasia apostasia
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: