# cargo nextest vs cargo test > nextest runs each test in its own process; cargo test shares one per binary. A test that leaks state failed 12 of 100 runs under cargo test, none under nextest. Web page: https://supercov.com/compare/cargo-nextest-vs-cargo-test · Published 2026-10-12 All Supercov pages for agents: https://supercov.com/llms.txt · Full text: https://supercov.com/llms-full.txt ## cargo nextest or cargo test? Use nextest when a workspace has many test binaries, when tests interfere with each other, or when CI needs retries and JUnit reports. Stay with `cargo test` for a small crate. Keep it for doctests either way: nextest does not run them. ## How each runs your tests `cargo test` runs one test binary at a time. Inside a binary, the tests share one process and run on threads. [nextest](https://nexte.st/docs/design/how-it-works/) builds the same binaries, lists the tests in them, then "executes each individual test in a separate process, in parallel". ```sh cargo install cargo-nextest --locked cargo nextest run cargo test --doc ``` ## A test that leaks state Our crate has a function that reads a process-wide flag, three unit tests and one doctest. One test turns the flag on and never turns it off. We ran each command 100 times on Rust 1.98.0 with nextest 0.9.138: | Command | Tests | Failed runs | | --- | --- | --- | | `cargo test` | 3 and the doctest | 12 of 100 | | `cargo nextest run` | 3, no doctest | 0 of 100 | Under `cargo test` the three tests share a process. When the flag is set before another test reads it, that test fails, and whether that happens depends on thread timing. Under nextest each test has its own process, so the flag cannot leak. The repeated `cargo test` runs used `--lib`, to leave the doctest out. The test is still wrong to leave the flag set. Fix it if the suite must also pass under `cargo test`. ## What differs | | `cargo test` | `cargo nextest run` | | --- | --- | --- | | Install | Built in | `cargo install cargo-nextest --locked`, or a prebuilt binary | | Process model | One process per test binary | One process per test | | Test binaries | One at a time | In parallel | | Doctests | Yes | No; run `cargo test --doc` | | Retries | No | `--retries`, with flaky tests reported | | CI reports | Text | JUnit XML | | Split across machines | No | `--partition` | | Custom test harnesses | Any | May need adapting | nextest publishes its own [benchmarks](https://nexte.st/docs/benchmarks/). The gain comes from running binaries in parallel, so measure it on your own workspace. ## Coverage with either runner cargo-llvm-cov works with both: `cargo llvm-cov` and `cargo llvm-cov nextest`. So does Supercov: ```sh npx supercov -- cargo test npx supercov -- cargo nextest run ``` On the crate above Supercov recorded coverage per test under both: 4 tests with `cargo test`, doctest included, and 3 with nextest, with 6/6 lines and 4/4 branches each time. It needs Rust 1.95 or newer and nextest 0.9.138 or newer, and keeps nextest's retries as separate attempts. For coverage tools, see [Rust branch coverage on stable: cargo-llvm-cov, Tarpaulin, Supercov](https://supercov.com/compare/rust-code-coverage.md). Example evidence: [fixture source, commands and recorded results (JSON)](https://supercov.com/downloads/tool-comparisons-2026-10-12.json). Measured October 12, 2026 with Supercov 4.3.0. These small examples are not a performance benchmark or a general conformance test.