Summary
Add --format
flag to rustc --test
to select testing output.
Motivation
Currently when testing Rust provide only human-readable output which is nice in most cases as we are humans or other humanoids. But from time to time we need to feed machine with results of our tests (i.e. some kind of CI that will report which tests failed or something like that) and there is no way to do that in “civilised” way. We need to parse non-machine-readable output which isn’t nice. But wait: there are some nice, standardized and well described formats for providing test output:
Use them for greater good!™
Detailed design
As described above just add flag to select desirable test output format which will take one of the possible values:
-
default
- current, human-readable format -
human
- alias fordefault
-
tap
- Test Anything Protocol which is nice format between human-readable and machine-readable -
tap-y
- next-gen TAP variation that use YAML stream with tests results, it allows to provide more data for sake of developer toolings -
tap-j
- like above but uses JSON instead of YAML
Drawbacks
Add some complexity in test results displaying but no more known drawback at this time.
Alternatives
Left as is, otherwise none.
Unresolved questions
Available output formats. For now it has been chosen based on my knowledge of well known and popular test output formats but I can miss something.