cargo2junit
cargo2junit copied to clipboard
Also report file names
It would be neat if this tool could also extract the filenames of the thing that's being tested (in the case of integration tests). For example:
Running unittests (target/debug/deps/generate_openapi_spec-e3bc6e08330e8181)
{ "type": "suite", "event": "started", "test_count": 0 }
{ "type": "suite", "event": "ok", "passed": 0, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": 0.000019477 }
Running tests/test_api_openapi.rs (target/debug/deps/test_api_openapi-53c722415f8c53df)
{ "type": "suite", "event": "started", "test_count": 1 }
{ "type": "test", "event": "started", "name": "read::can_read" }
{ "type": "test", "name": "read::can_read", "event": "ok" }
{ "type": "suite", "event": "ok", "passed": 1, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": 0.06092743 }
As we can see, we can extract the filenames from that text. These would then end up in <testcase file=tests/test_api_openapi.rs/> which I think would be quite neat. GitLab can actually display those: https://gitlab.com/gitlab-org/gitlab/-/issues/119032
@svenstaro does that work when using --test-threads?
Hm good question and I actually don't know.
I was looking into the source code of cargo test to see if we can extend the json format one way or another to include this on the line itself, removing all ambiguity.