cargo test runs tests sequentially within each test binary. For projects with hundreds of tests, that means waiting. cargo-nextest runs each test as a separate process in parallel, cutting feedback time dramatically.
Pre-built binaries (recommended — compiling from source can fail due to nightly dependencies):
# macOS (Apple Silicon or Intel)
curl -LsSf https://get.nexte.st/latest/mac | tar xzf - -C ~/.cargo/bin
# Linux x86_64
curl -LsSf https://get.nexte.st/latest/linux | tar xzf - -C ~/.cargo/bin
Verify:
cargo nextest --version
# cargo-nextest 0.9.128
Drop-in replacement for cargo test:
# Run all tests
cargo nextest run
# Filter by test name
cargo nextest run noise_figure
# Run tests in a specific package (workspace)
cargo nextest run -p rfconversions
# List tests without running
cargo nextest list
The output is cleaner than cargo test — each test gets a PASS/FAIL line with timing:
PASS [ 0.005s] rfconversions::tests cascade_noise_factor_two_stages
PASS [ 0.006s] rfconversions::tests db_to_linear_zero
PASS [ 0.004s] rfconversions::tests frequency_to_wavelength_roundtrip
────────────
Summary [ 0.083s] 114 tests run: 114 passed, 0 skipped
Performance across five RF engineering crates (720 tests total):
| Crate | Tests | cargo test | cargo nextest run | Speedup |
|---|---|---|---|---|
| rfconversions | 114 | 8.1s | 0.2s | 40× |
| touchstone | 152 | ~4s | 0.4s | 10× |
| gainlineup | 122 | ~3s | 0.5s | 6× |
| linkbudget | 196 | ~5s | 0.4s | 12× |
| regulatory-rf | 136 | ~8s | 2.6s | 3× |
| Total | 720 | ~28s | ~4.1s | ~7× |
The biggest gains come from crates with many small, independent tests. Crates with inherently slow tests (Monte Carlo simulations in regulatory-rf) are bottlenecked by the slowest individual test regardless of parallelism.
Important: nextest does not run doctests. If your crates use doc-tests extensively (and they should — they serve as both documentation and regression tests), you need both:
# Fast parallel unit + integration tests
cargo nextest run
# Doctests (still sequential)
cargo test --doc
Combine them in a Just recipe for complete coverage:
# Full test suite: nextest for speed + doctests for completeness
test-full:
cargo nextest run
cargo test --doc
Create .config/nextest.toml in your project root:
[profile.default]
# Stop on first failure (good for local dev)
fail-fast = true
# Retry flaky tests (useful in CI)
retries = 0
# Kill tests that take too long
slow-timeout = { period = "60s", terminate-after = 2 }
[profile.ci]
# CI profile: don't fail fast, retry once
fail-fast = false
retries = 1
Use profiles:
cargo nextest run --profile ci
For repos spread across multiple directories (not a Cargo workspace):
#!/usr/bin/env bash
# test-fast.sh — run nextest across all crates
set -euo pipefail
CRATES=(rfconversions touchstone gainlineup linkbudget regulatory-rf)
TOTAL=0
FAILED=0
for crate in "${CRATES[@]}"; do
echo "=== $crate ==="
cd ~/Development/"$crate"
if cargo nextest run 2>&1; then
((TOTAL++))
else
((FAILED++))
fi
done
echo ""
echo "Results: $((TOTAL)) passed, $FAILED failed out of ${#CRATES[@]} crates"
| Scenario | Tool |
|---|---|
| Fast feedback during development | cargo nextest run |
| CI (full coverage) | cargo nextest run && cargo test --doc |
| Debugging with print output | cargo test -- --nocapture |
| Running specific doctests only | cargo test --doc specific_fn |
| Flaky test detection | cargo nextest run --retries 3 |