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

JUnit test results with a null classname are not correctly handled

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 6.0.0
    • 5.14.4.1, 5.15.5
    • Tests
    • None

      Summary

      Bamboo test results show unexpected results when testcase classpath is null

      Steps to Reproduce

      1. Create a build that parses the following test file
        <testsuite errors="0" failures="0" name="name" skips="0" tests="2" time="0.2">
          <testcase classname="classname" file="file" line="1" name="test_class" time="0.1"/>
          <testcase classname="" file="test" line="1" name="test_class" time="0.1"/>
        </testsuite>
        
      2. Run the build and check the results

      Expected Results

      Bamboo will show the two tests as expected in <Bamboo_URL>/browse/PLAN-KEY-XXX/test and <Bamboo_URL>/browse/PLAN-KEY-XXX/test/case/0 .

      Actual Results

      The page <Bamboo_URL>/browse/PLAN-KEY-XXX/test will not show the correct total number for tests:

      The page <Bamboo_URL>/browse/PLAN-KEY-XXX/test/case/0 will show an unespected error:

            [BAM-18510] JUnit test results with a null classname are not correctly handled

            Ellie Z (they/them) added a comment - - edited

            This issue was resolved by adding a default name for test cases with no class name.
            If you use an earlier Bamboo version, you can work around this issue by adding a "fake" class name to your JUnit results in the classname parameter of the testcase tag.
            For example, this could be done in a Script task just before the parser, containing:

            sed -i 's/classname=""/classname="no name"/' *.xml

            Ellie Z (they/them) added a comment - - edited This issue was resolved by adding a default name for test cases with no class name. If you use an earlier Bamboo version, you can work around this issue by adding a "fake" class name to your JUnit results in the classname parameter of the testcase tag. For example, this could be done in a Script task just before the parser, containing: sed -i 's/classname= ""/classname=" no name"/' *.xml

              Unassigned Unassigned
              dsantos Daniel Santos (Inactive)
              Affected customers:
              0 This affects my team
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: