You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently cargo test doesn't show how many tests were executed as a whole, it only prints separate sums of parts during its run. This is a problem for a few reasons:
when writing new tests or refactoring the folder and file structure of them, it's important to validate that the expected number of tests were found and executed by cargo
in CI, it's helpful to monitor changes in number of executions, especially sudden abnormalities
each party interested in this information has to resort to custom scripts for parsing cargo test output, which may not have stability guarantees for its format and does not provide output specifically for machines
For example, right now the output of running tests looks something like this in one of my projects:
cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.24s
Running target/debug/deps/app-8c1045fb0e6ad4a5
running 4 tests
test module_name::tests::foo ... ok
(...)
test module_name::tests::bar ... ok
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Running target/debug/deps/integration_test_baz-dfdc5981450fbc5e
running 1 test
test integration_test_baz ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
(...)
Running target/debug/deps/integration_test_something-b4e63349a484d05d
running 1 test
test integration_test_something ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Doc-tests app
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Notice how every integration test is followed by: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
At the end we can always see test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
because that project doesn't have doc tests, even though a lot of unit and integration tests were executed.
Describe the solution you'd like
At the end cargo test could print a summary of all executed tests like this (assuming 40 unit and 17 integration tests passed):
Summary: ok. 57 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Alternatively, it could split the summary into categories:
Summary:
Unit tests: ok. 40 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Integration tests: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Doc tests: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
All: ok. 57 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
The exact formatting is up for debate.
The text was updated successfully, but these errors were encountered:
Thanks for the report. Closing as a duplicate of #4324. Cargo would need to use the libtest json output, and it's currently unstable and I'm not sure what else would need to be addressed.
Describe the problem you are trying to solve
Currently
cargo test
doesn't show how many tests were executed as a whole, it only prints separate sums of parts during its run. This is a problem for a few reasons:cargo test
output, which may not have stability guarantees for its format and does not provide output specifically for machinesFor example, right now the output of running tests looks something like this in one of my projects:
Notice how every integration test is followed by:
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
At the end we can always see
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
because that project doesn't have doc tests, even though a lot of unit and integration tests were executed.
Describe the solution you'd like
At the end
cargo test
could print a summary of all executed tests like this (assuming 40 unit and 17 integration tests passed):Alternatively, it could split the summary into categories:
The exact formatting is up for debate.
The text was updated successfully, but these errors were encountered: