cargo2junit
cargo2junit copied to clipboard
Breaking unit tests in test cases based on module.
I was wondering if it would be possible to break the unit tests into testsuite
based on the module the tests reside in.
Given the following example of a current file:
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite id="0" name="darwin" package="darwin" tests="5" errors="0" failures="0" hostname="localhost" timestamp="2022-12-03T21:23:25.627281Z" time="0">
<testcase name="test_one" time="0" classname="cli::test" />
<testcase name="test_four" time="0" classname="data::tests" />
<testcase name="test_two" time="0" classname="data::tests" />
<testcase name="test_three" time="0" classname="cli::tests" />
</testsuite>
</testsuites>
The following would be created
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite id="0" name="cli" package="testsuite/cli" tests="5" errors="0" failures="0" hostname="localhost" timestamp="2022-12-03T21:23:25.627281Z" time="0">
<testcase name="test_one" time="0" classname="cli::test" />
<testcase name="test_three" time="0" classname="cli::tests" />
</testsuite>
<testsuite id="1" name="data" package="testsuite/data" tests="5" errors="0" failures="0" hostname="localhost" timestamp="2022-12-03T21:23:25.627281Z" time="0">
<testcase name="test_four" time="0" classname="data::tests" />
<testcase name="test_two" time="0" classname="data::tests" />
</testsuite>
</testsuites>
This would help break things in some CI systems, like Jenkins, into more fragmented chunks; imho.
@madelaney Can you share the JSON output that cargo test
emits?