Integration tests in tests/ directory

14289
0

Integration tests go in the tests/ directory and are compiled as separate binaries. Each file in tests/ is a separate test crate with access only to your crate's public API. This enforces API-level testing and catches issues that unit tests miss. I use integration tests for end-to-end scenarios, CLI testing, and verifying that public APIs work together. The tests can use external dependencies (like reqwest for HTTP testing) without bloating the main crate. cargo test runs both unit and integration tests. For setup/teardown, I use modules or helper functions. Integration tests are slower than unit tests because each file is a separate binary, but they provide confidence that your crate works as a whole.