Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-840

JUnit XML Improperly Parsed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 1.2
    • 1.0-rc2
    • Tests
    • None

    Description

      The XML produced by JUnit isn't parsed properly for some tests. We install an uncaughtExceptionHandler for multi-threaded tests, and forward the exceptions to TestResult object that was used to start the test. This allows multiple exceptions to happen in a single testmethod, and additional exceptions to happen before the test-proper begins and after all the tests finish. The errors outside the scope of a particular test are done by adding a new test to the suite called "LimeTestSuite - Before Test Errors" (or After Test Errors) and having that test add an error or failure to the test result object the suite is using.

      The XML this produces looks as follows:
      <testsuite errors="2" failures="0" name="com.limegroup.gnutella.xml.MetaFileManagerTest" tests="28" time="93.47">
      <!-- properties -->
      <!-- the normal result... -->
      <testcase classname="com.limegroup.gnutella.xml.MetaFileManagerTest" name="testSensitiveDirectoryPredicate" time="0.035"></testcase>
      <!-- the abnormal result... -->
      <testcase classname="org.limewire.util.LimeTestSuite$1" name="LimeTestSuite - After Test Errors" time="0.02">
      <error message="/spare/bamboo/data/xml-data/build-dir/LW-NIGHTLY/limewire/testData/com.limegroup.gnutella.xml.MetaFileManagerTest/settings/fileurns.cache (No
      such file or directory)" type="java.io.FileNotFoundException">java.io.FileNotFoundException: /spare/bamboo/data/xml-data/build-dir/LW-NIGHTLY/limewire/testData/co
      m.limegroup.gnutella.xml.MetaFileManagerTest/settings/fileurns.cache (No such file or directory)
      at java.io.FileOutputStream.open(Native Method)
      at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
      at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
      at com.limegroup.gnutella.UrnCache.persistCache(UrnCache.java:323)
      at com.limegroup.gnutella.FileManager.save(FileManager.java:404)
      at com.limegroup.gnutella.xml.MetaFileManager.save(MetaFileManager.java:313)
      at com.limegroup.gnutella.xml.MetaFileManager$Saver.run(MetaFileManager.java:466)
      at org.limewire.concurrent.SimpleTimer$1.run(SimpleTimer.java:70)
      at org.limewire.concurrent.SimpleTimer$MyTimerTask.run(SimpleTimer.java:125)
      at java.util.TimerThread.mainLoop(Timer.java:512)
      at java.util.TimerThread.run(Timer.java:462)
      </error>
      </testcase>
      </testsuite>

      These abnormal errors are showing up in Bamboo as being from 'LimeTestSuite$1', so it looks like Bamboo is grouping by the classname attribute of the testcase element, whereas most other junit reporters group by the classname of the encompassing suite element. Without this fix, it's impossible to tell from looking at the Bamboo reports where one of these errors occurred.

      Attachments

        Issue Links

          Activity

            People

              bmccoy bmccoy
              392fb6eb772b Sam Berlin
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: