It is beneficial to put Rust integration tests (those standalone tests in /tests) folder into a single crate.

In other word, instead of doing

tests/
  foo.rs
  bar.rs

do

tests/
  integration/
    foo.rs
    bar.rs

instead.

There are two advantage of that:

  • Faster build time since Rust compiler don’t need to link for each individual test crates
  • Fast run time since Rust can run all tests in parallel, but cargo can only run executables sequentially

References