I use Ember 5.6.0. Running ember test --silent --reporter xunit > ember-test-result.xml
outputs an XML with the following content:
<testsuite name="Testem Tests" tests="439" skipped="0" todo="0" failures="0" timestamp="Thu Jun 06 2024 12:07:57 GMT+0200 (Central European Summer Time)" time="13.557">
<testcase classname="Chrome 125.0" name="acceptance/login-view-test.js: some test" time="0.157"/>
<testcase classname="Chrome 125.0" name="acceptance/login-view-test.js: some other test" time="0.065"/>
<testcase classname="Chrome 125.0" name="acceptance/login-view-test.js: some third test" time="0.072"/>
<testcase classname="Chrome 125.0" name="Integration | components | parameter-tile: test this as well" time="0.047"/>
<testcase classname="Chrome 125.0" name="Integration | helpers | equal: same values are equal" time="0.047"/>
<testcase classname="Chrome 125.0" name="Integration | helpers | equal: different values are not equal" time="0.045"/>
<testcase classname="Chrome 125.0" name="Integration | helpers | equal: strict equal comparision is used" time="0.046"/>
<testcase classname="Chrome 125.0" name="Integration | Helper | greater: equals is false" time="0.037"/>
<testcase classname="Chrome 125.0" name="Integration | Helper | greater: 2>1 is true" time="0.038"/>
<testcase classname="Chrome 125.0" name="Integration | Helper | greater: 1>2 is false" time="0.036"/>
<!-- ... about 400 more lines ... -->
</testsuite>
I'd like to configure this. The classname
should be the file (maybe with path?), the name
should only be the actual test case's name, stuff like that. The testsuite
's name being "Testem Tests" isn't ideal as well. Is there a way?
The documentation is rather minimalistic, but maybe I miss something. Or maybe I have to use some Custom Reporter, but I'd like that to inherit from xunit, would that be an option?
I think you'd have to write a custom reporter. somehow.
Here is the xunit reporter code for reference: https://github.com/testem/testem/blob/1c2a5bdb3beb5f52911deb738c204d569c33d511/lib/reporters/xunit_reporter.js#L6
Some challenges you'll run in to:
For managing the name differently, you'd probably have better luck post-processing the file. for example:
let xml = fs.readFile('thefile.xml')
let parsedXML = someLibrary(xml);
parsedXML['testsuite'].forEach(suite => {
suite['testcase'].forEach(case => {
let [className, ...name] = case.name.split(':');
case.className = className;
case.name = name.join(':');
})
})
// TODO: write the file