Open ZSmallX opened 1 year ago
Here is some example data which shows the issue:
If you merge first the mypy xml, then the pytest xml, the result is wrong (nested testsuites). If you switch the order (pytest with two testsuites, then mypy) the result is as expected.
The workaround proposed above behaves correctly for both cases.
<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="0" name="mypy" skips="0" tests="1" time="1.009">
<testcase classname="mypy" file="mypy" line="1" name="mypy-py3_8-win32" time="1.009">
</testcase>
</testsuite>
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite errors="0" failures="0" hostname="GAIA02" name="pytest" skipped="0" tests="2" time="0.630" timestamp="2023-08-18T14:49:23.787800">
<testcase classname="tests.test_crop_box" file="tests\test_crop_box.py" line="9" name="test_crop_box" time="0.094"></testcase>
<testcase classname="tests.test_utils" file="tests\test_utils.py" line="5" name="test_collect_files" time="0.001"></testcase>
</testsuite>
</testsuites>
Description: I got the following nested results when merge one JUnit XML with root element
testsuite
and another JUnit XML with root elementtestsuites
.JUnit XML with
testsuite
(nametest_suite.xml
in code):JUnit XML with
testsuites
(nametest_suites.xml
in code):And I run the code:
Actual:
Expected:
My Solution: And currently I solved this problem by converting all
testsuite
JUnit XML totestsuites
JUnit XML and then update the statistics.I think this could be done in junitparser side to make it compatibile with merging
testsuite
andtestsuites
and get the right statistics.