JUnit runs have incorrect suites in the xml files


(rIT) #1

Hi,

We have a basic setup for unit tests as follows :

@RunWith(Suite.class)
@Suite.SuiteClasses({
TestA.class
})
public class TestSuite {
}

We use the below command to run the suite :

gradle cleanTest test --tests=*Suite

The problem I’m facing is with the xml files generated after the test run is as below :

There is one xml file generated for the suite class which contains no info :

<?xml version="1.0" encoding="UTF-8"?

<testsuite name=“com.modules.TestSuite” tests=“0” skipped=“0” failures=“0” errors=“0” timestamp=“1970-01-01T00:00:00” hostname="" time=“0.0”
<properties/
<![CDATA[Tests to execute: com.modules.TestSuite
Finished: TestClasses
]]</system-out
<system-err<![CDATA[]]</system-err
</testsuite

And there is another one generated for the test classes included in the suite :

<?xml version="1.0" encoding="UTF-8"?

<testsuite name=“com.modules.TestClass” tests=“5” skipped=“0” failures=“5” errors=“0” timestamp=“2018-02-12T11:24:12” hostname="" time=“50.09”
<properties/
<testcase name=“testMethod” classname=“com.modules.TestClass” time=“10.012”
</testsuite