-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON output is not emitted until tests end #1256
Comments
Hi @hobovsky -- thanks for the report! It does look like that is the case at the moment. We can definitely do better here. I think this is because libtest produces its outputs test binary by test binary (suite by suite). Wonder if @Jake-Shadle has thoughts here. Can we interleave outputs from various test binaries? Maybe as an option. See nextest/nextest-runner/src/reporter/structured/libtest.rs Lines 260 to 262 in 4872df6
|
Test suites are outputted as a single block to match libtest, eg.
But nextest executes tests much differently so that matching libtest means all tests in a suite need to be finished before the block can be outputted, otherwise the suite start/end will have no meaning since the tests that would be outputted are essentially random and the libtest format has no way to say which suite a test is a part of. That being said, output is not only emitted at the end, it's outputted as soon as each test suite completes nextest/nextest-runner/src/reporter/structured/libtest.rs Lines 421 to 429 in 1fe5789
but is heavily dependent on how many suites are executed and when they finish relative to the end time of the entire test run. IMO there is no clean "fix" to this without changing the output format to either allow each test to be able to reference its parent suite by name/id, and/or remove the suite begin/end output in favor of the consumer creating their own accumulator. |
Ok so I did not notice that JSON is output after every test suite because I focused too much on having test cases reported separately and I had only one test suite. But about the order of reported events, isn't it already solved? when |
Ah interesting, yeah -- if tests are being run serially we can produce lines ASAP. |
With
cargo test -- -Z unstable-options --format json
, I seem to receive JSON lines as soon as a corresponding event is emitted. Withcargo nextest run --message-format libtest-json --color never --failure-output immediate --success-output immediate
, or pretty much any other combination I try, JSON is output only after all tests are complete, before the final summary. Is my observation correct? IS there a way to receive any form of machine readable output as tests progress? In my use case, I am not interested with the console feedback or human readable messages at all, I need only any form of machine readable output, but I need it to be available around the time of a corresponding test event, and not at the very end. Is it possible to satisfy my use case with currently available state ofnextest
? I figured out that one reason for such behavior could be that otherwise it would not be possible to avoid interleaved messages of different formats, but maybe it would be worth to have an option to suppress the original, human readable messages, and have immediate JSON lines instead?The text was updated successfully, but these errors were encountered: