Is it possible to use the cargo
command to run library tests (i.e.., cargo test --lib
) and documentation tests without running any integration tests (i.e., the tests in the crate's top-level tests
directory)? Bonus points are awarded for compiling the integration tests without running them.
Here's the bigger picture. My crate is a client library for a web service, and the HTTP server is not part of the crate. I've organized my crate into:
- Library tests, which do not depend on the HTTP server,
- Documentation tests, which do not depend on the HTTP server, and
- Integration tests, which require the HTTP server to be running on the localhost.
As such, it's sometimes unfeasible to have the HTTP server running on the machine building the crate—e.g., a Travis CI build agent. In these situations I would like to build all tests but exclude all integration tests from running because every integration test will fail.