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

single-file JUnit XML format hides <system-out>

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • junit-plugin
    • None
    • Platform: All, OS: All

      hi! Hudson is great, thanks for writing it We're using it heavily
      in the ASF these days: http://hudson.zones.apache.org/hudson/

      Quick bug report. I'm writing a TAP-to-JUnit-XML conversion script for our
      usage of Hudson in Apache SpamAssassin (which is written in perl, and therefore
      uses TAP, the Test Anything Protocol, for test output interchange). the script
      is here, if anyone's interested –
      http://jmason.org/software/scripts/tap-to-junit-xml.txt

      Anyway, there appears to be a small bug in how Hudson interprets the
      single-file format (multiple <testsuite> blocks contained by one <testsuites>
      container), compared to the multiple-file format (each file contains one
      <testsuite> block, no <testsuites> container). With single-file format, the
      <system-out> block is never displayed, whereas it is displayed fine with
      multiple-file format.

      I suspect the "it.parent" pointer in the jelly file is pointing at the
      top-level parent node – the <testsuites> node – rather than the immediate
      parent node, the <testsuite> node that the current <testcase> is contained by.
      (that's just a guess, though.)

      Here's single-file output:

      http://hudson.zones.apache.org/hudson/job/SpamAssassin-tap-parser-test/36/testReport/make_test/t_basic_lint_t/test______1/

      And here's what multi-file output looks like on the same input:

      http://hudson.zones.apache.org/hudson/job/SpamAssassin-tap-parser-test/37/testReport/make_test/t_basic_lint_t/test______1/

      if you need more info, let me know and I'll try to dig up a demo XML file.

          [JENKINS-1472] single-file JUnit XML format hides <system-out>

          redsolo added a comment -

          Yes, there is a difference on how the content in the XML files are parsed. There
          is no XML schema for JUnit XML reports (or standard), so the logic for handling
          multiple test suites in a file is a little hackish.

          Could you please attach an example of the single-file XML report? I looked in
          your workspace for the job, but could not find a single junit xml file.

          redsolo added a comment - Yes, there is a difference on how the content in the XML files are parsed. There is no XML schema for JUnit XML reports (or standard), so the logic for handling multiple test suites in a file is a little hackish. Could you please attach an example of the single-file XML report? I looked in your workspace for the job, but could not find a single junit xml file.

          redsolo added a comment -

          Created an attachment (id=198)
          File containing stdout and one test suite

          redsolo added a comment - Created an attachment (id=198) File containing stdout and one test suite

          jmason added a comment -

          it's a pity there's no well-defined standard or schema; even some kind of "best
          practices" would be welcome.

          Here's a sample of the single-file format. here's how it is displayed on our
          Hudson:

          http://hudson.zones.apache.org/hudson/view/SpamAssassin/job/SpamAssassin-tap-parser-test/39/testReport/make_test/

          here's an example of the missing stdout:

          http://hudson.zones.apache.org/hudson/view/SpamAssassin/job/SpamAssassin-tap-parser-test/39/testReport/make_test/t_basic_lint_t/test______1/

          jmason added a comment - it's a pity there's no well-defined standard or schema; even some kind of "best practices" would be welcome. Here's a sample of the single-file format. here's how it is displayed on our Hudson: http://hudson.zones.apache.org/hudson/view/SpamAssassin/job/SpamAssassin-tap-parser-test/39/testReport/make_test/ here's an example of the missing stdout: http://hudson.zones.apache.org/hudson/view/SpamAssassin/job/SpamAssassin-tap-parser-test/39/testReport/make_test/t_basic_lint_t/test______1/

          jmason added a comment -

          Created an attachment (id=200)
          singlefile.xml

          jmason added a comment - Created an attachment (id=200) singlefile.xml

          Thanks for a test case. Fixed in 1.203.

          Kohsuke Kawaguchi added a comment - Thanks for a test case. Fixed in 1.203.

          Code changed in hudson
          User: kohsuke
          Path:
          /hudson/hudson/main/core/src/main/java/hudson/tasks/junit/SuiteResult.java (1.14)
          /hudson/hudson/main/core/src/main/java/hudson/tasks/junit/TestResult.java (1.18)
          /hudson/hudson/main/core/src/main/java/hudson/tasks/junit/CaseResult.java (1.15)
          /hudson/hudson/main/core/src/test/java/hudson/tasks/junit/SuiteResultTest.java (1.2)
          /hudson/hudson/main/core/src/test/resources/hudson/tasks/junit/junit-report-1472.xml (1.1)
          http://fisheye5.cenqua.com/changelog/hudson/?cs=MAIN:kohsuke:20080403080351

          Log:
          fixed issue #1472.
          For us to keep sanity in parsing JUnit XML, I think we have to break the earlier fix we made for JBoss guys. See http://www.nabble.com/difference-in-junit-publisher-and-ant-junitreport-td12265700.html#a12265700 for more about that.
          The problem is that the fix for issue #1233 is at odds with this XML that JBoss uses, when it comes to whether <testsuite>/@name should win or <testcase>/@classname wins.
          JUnit XML from JBoss was said to be written by a custom formatter, so I think we can be justified in breaking that in favor of #1233 (although junit XSLT apparently handles that correctly.)

          SCM/JIRA link daemon added a comment - Code changed in hudson User: kohsuke Path: /hudson/hudson/main/core/src/main/java/hudson/tasks/junit/SuiteResult.java (1.14) /hudson/hudson/main/core/src/main/java/hudson/tasks/junit/TestResult.java (1.18) /hudson/hudson/main/core/src/main/java/hudson/tasks/junit/CaseResult.java (1.15) /hudson/hudson/main/core/src/test/java/hudson/tasks/junit/SuiteResultTest.java (1.2) /hudson/hudson/main/core/src/test/resources/hudson/tasks/junit/junit-report-1472.xml (1.1) http://fisheye5.cenqua.com/changelog/hudson/?cs=MAIN:kohsuke:20080403080351 Log: fixed issue #1472. For us to keep sanity in parsing JUnit XML, I think we have to break the earlier fix we made for JBoss guys. See http://www.nabble.com/difference-in-junit-publisher-and-ant-junitreport-td12265700.html#a12265700 for more about that. The problem is that the fix for issue #1233 is at odds with this XML that JBoss uses, when it comes to whether <testsuite>/@name should win or <testcase>/@classname wins. JUnit XML from JBoss was said to be written by a custom formatter, so I think we can be justified in breaking that in favor of #1233 (although junit XSLT apparently handles that correctly.)

          jazzjack added a comment -

          i've found a schema.
          it doesn't look like official document
          but may be useful anyway
          http://jra1mw.cvs.cern.ch:8180/cgi-bin/jra1mw.cgi/org.glite.testing.unit/config/
          JUnitXSchema.xsd?view=markup&content-type=text%2Fvnd.viewcvs-
          markup&revision=HEAD

          jazzjack added a comment - i've found a schema. it doesn't look like official document but may be useful anyway http://jra1mw.cvs.cern.ch:8180/cgi-bin/jra1mw.cgi/org.glite.testing.unit/config/ JUnitXSchema.xsd?view=markup&content-type=text%2Fvnd.viewcvs- markup&revision=HEAD

            Unassigned Unassigned
            jmason jmason
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: