feat(libtest): Add JUnit formatter by andoriyu · Pull Request #84568 · rust-lang/rust (original) (raw)
Hm, I have some mild reservations about supporting junit (and other more specialized frameworks). We already have a json backend, and it seems likely that could be mapped to junit with an external crate if desired. That does hurt usability somewhat, but I'm not sure it makes sense to support all possible test output formats in-tree either.
Can you perhaps share what is expected to consume the junit output? Or what the motivation is?
Well, JUnit is universally supported format: a lot of test harnesses/runners support JUnit as an output format, many Continuous Integration platforms support consuming it. I think CI would be a common use case to use JUnit as output. There is no point on supporting all other formats, like you said, because JUnit format is the least common denominator across all of them.
As for JSON backend goes, well, it's not stabilized and not documented. You can map it to JUnit, like you said, I did that in cargo-suity. In my opinion, this is a task for test harness, rather than 3rd party library.
Personally, I would prefer if I could keep console output, and write JUnit report into a file in parallel.