
Test Organization in Rust for Large Workspaces Explained
Organize Rust tests in a large workspace: unit tests beside code, integration tests per crate, a shared test-support crate, slow test gating and what to run in CI.
Tag
5 posts

Organize Rust tests in a large workspace: unit tests beside code, integration tests per crate, a shared test-support crate, slow test gating and what to run in CI.

Declare each dependency version once in the workspace root and inherit it in members with workspace = true. Learn the syntax, adding features per member and what cannot be inherited.

A workspace groups crates under one Cargo.lock and target directory. See when to split, the root manifest, virtual versus root package workspaces, running commands per member and what to avoid.

Share one version, one edition and one lint set across a workspace. See [workspace.package], [workspace.lints] and workspace = true in members.

A guide to Cargo beyond cargo build: the manifest, dependency versions, features, workspaces, profiles, MSRV, publishing and the errors you will meet along the way.