# Aleksey Kladov - Delete Cargo Integration Tests (Highlights) ![rw-book-cover|256](https://readwise-assets.s3.amazonaws.com/static/images/article1.be68295a7e40.png) ## Metadata **Cover**:: https://readwise-assets.s3.amazonaws.com/static/images/article1.be68295a7e40.png **Source**:: #from/readwise **Zettel**:: #zettel/fleeting **Status**:: #x **Authors**:: [[Aleksey Kladov]] **Full Title**:: Delete Cargo Integration Tests **Category**:: #articles #readwise/articles **Category Icon**:: 📰 **URL**:: [matklad.github.io](https://matklad.github.io//2021/02/27/delete-cargo-integration-tests.html) **Host**:: [[matklad.github.io]] **Highlighted**:: [[2021-03-03]] **Created**:: [[2022-09-26]] ## Highlights - Note that rustc needs to repeatedly re-link the library crate with each of the integration tests. This can add up to a significant compilation time blow up for tests. That is why I recommend that large projects should have only one integration test crate with several modules. - For a library with a public API which is published to crates.io, I avoid unit tests. Instead, I use a single integration tests, called it (integration test) #favorite - avoid doc tests in internal libraries for big projects and add this to Cargo.toml ``` [lib] doctest = false ``` - Second, prefer ``` #[cfg(test)] mod tests; // tests in `tests.rs` file ... This way, when you modify just the tests, the cargo is smart to not recompile the library crate. ```