I have a project with a library and two executables. When I run cargo test
, it runs five executables: the unit tests for the library and both executables, integration tests, and doc tests.
Since I have only library and integration tests, I get annoying output like:
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
I have tried to filter it with Cargo parameters but failed. If I use --lib
then no integration tests are run. Also I didn't find a way to run integration tests only or to skip doc or executable tests.
-
Is there any way to run only integration and library unit tests?
-
Rust Book recommends to move almost all code from main.rs to lib.rs. So why tests for binaries are exists by default?