Matched signals
- test result: FAILED
- test.*\.\.\.\s*FAILED
- failures:
- FAILED tests
- error\[E
Cargo test suite reported one or more test failures
What this failure means
One or more Rust tests failed. The cargo test runner reported individual
failures with test X ... FAILED and the suite summary shows
failures: N tests failed.
Symptoms
Faultline looks for one or more of these log fragments:
test result: FAILED
test.*\.\.\.\s*FAILED
failures:
FAILED tests
error\[E
Diagnosis
cargo test terminated with a non-zero exit code. Individual failing tests
are reported as:
test path::to::test_name ... FAILED
failures:
---- path::to::test_name stdout ----
thread 'main' panicked at 'assertion `left == right` failed', src/lib.rs:42
failures:
path::to::test_name
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
Common causes:
- Assertion failure —
assert_eq!,assert!, orpanic!did not hold; the implementation changed or a test expectation is stale. - Panic in test — the code under test panicked (index out of bounds, unwrap on None, etc.).
- Compile error in test — the test file has a type error or missing
dependency;
cargo testreportserror[E...]before the test run. - Thread panic — a spawned thread panicked and the test did not catch it.
Fix steps
-
Reproduce locally:
cargo test cargo test -- --nocapture # show stdout from failing tests -
Run only the failing test:
cargo test path::to::test_name cargo test test_name -- --nocapture -
Read the panic message and backtrace:
RUST_BACKTRACE=1 cargo test path::to::test_name -- --nocapture -
For
assert_eq!failures, the output shows both left and right values — identify which side changed. -
For compile errors in tests, run
cargo check --teststo see all type errors without executing tests.
Validation
cargo testexits zero.- Individual test:
cargo test path::to::test_namepasses.
Why it matters
Cargo test failures are deterministic and block the pipeline. The failure output names the exact test function and the assertion that failed, making root-cause analysis straightforward. Even a single test failure returns a non-zero exit code, preventing downstream publish or deploy steps.
Prevention
- Run
cargo testas a pre-push hook. - Use
cargo test -- --nocapturelocally to see all output during development. - Keep tests hermetic: avoid relying on file paths, environment variables, or network access in unit tests.
Try it locally
cargo test
cargo test -- --nocapture
RUST_BACKTRACE=1 cargo test -- --nocapture
cargo test
How Faultline detects it
Use faultline explain cargo-test-failure to see the full playbook.
faultline analyze build.log
faultline explain cargo-test-failure
Generated from playbooks/bundled/log/test/cargo-test-failure.yaml. Do not edit directly.