Details
-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Minor
-
Resolution: Duplicate
-
Component/s: nunit-plugin
-
Labels:None
-
Environment:Windows Server 2003, Jenkins 1.497, Jenkins NUnit plugin 0.14, NUnit 2.6.2
-
Similar Issues:
Description
In the conversion of the NUnit XML results to JUnit, some tests are named incorrectly. When an NUnit output file contains a test-suite of type "TestFixture" containing a results element containing both test-suites of type "ParameterizedTest" and test-cases (not parameterized), the test-cases are reported with incorrect namespace and class names. It is as if some code were determining the namespace/class names to report by walking a certain number of tokens back in a fully qualified class name, and too many steps back are being taken for simple tests when parameterized tests are present.
In TestResultLevel1.jpg all tests should appear under pacakge ASI.SOP.AmazonBTI.Tests. TestResultLevel3.jpg shows the badly parsed name AmazonUpcParseStrategyTests.ShouldRequireProductProgramFinder.
Attachments
Issue Links
- duplicates
-
JENKINS-13471 Tests listed in incorrect namespace
-
- Resolved
-
I think I'm seeing the same thing, on Windows7 and Windows Server 2008 R2, building the plugin from the GitHub source commit f73f7bdb0df8fa239c376dedfadab2d601fde68d.
The problem as I see it is that when we're calculating $firstTestName in nunit-to-junit.xsl, after the first test-case in a results is found, we jump back up two levels to the test-suite, but then base the firstTestName off the first test-case descendent, on any level. This may not be the same test-case that we started from. And when we have parameterized tests, the names may be different enough to throw things off.
I'll attach two very small NUnit source/JUnit output files that show the difference in just a second.
In my example, we have a parameterized test that appears in the NUnit output before the simple test. When we try to find the firstTestName for the simple test, we accidentally use the name of the first parameterized test-case.
I think the fix is to replace
on lines 11 and 12 with
Then we'll end up at the same test-case node we started at, and will get the correct firstTestName.
I can also submit a pull request on GitHub, if you'd like.