Rust test insights
Tuist reports individual test results from cargo test, including unit tests, integration tests, and doctests. No Rust dependency or additional test runner is required.
- Follow the Rust project setup.
Report your test runs#
tuist cargo test --workspace
With the mise Cargo wrapper configured, you can keep typing cargo test. Cargo still compiles and runs your tests, with its usual arguments, output, and exit code. Reporting failures do not change the result of your tests.
You can select a package or filter tests as usual:
tuist cargo test -p store
tuist cargo test authentication
What Tuist tracks#
- Passed, failed, and ignored tests from completed test suites.
- Unit tests, integration tests, and doctests.
- Whole-suite durations.
- Available branch, commit, CI, and runner metadata.
Filtered tests and tests not executed after a failure are never reported as passing. Results appear under Tests in the dashboard.
Continuous integration#
Tuist recognizes GitHub Actions, GitLab CI, Bitrise, CircleCI, Buildkite, and Codemagic, and links each run to its CI job. On any other CI system, a run counts as a CI run when the CI environment variable is set. Most CI systems set it; set it yourself where they don't, such as on Fly.io Machines. Flaky test detection only compares CI runs.
A job that checks out a commit rather than a branch leaves Git without a branch to name, so its runs have no branch. On the CI systems Tuist recognizes, the branch comes from the provider. Elsewhere, name it with TUIST_GIT_BRANCH:
CI=true TUIST_GIT_BRANCH=main tuist cargo test --workspace
Packages, modules, and test cases#
Tuist groups results by Cargo package and target. Rust module paths group individual tests within a target:
| Dashboard label | Rust meaning | Example |
|---|---|---|
| Modules | Cargo package and target | store::api |
| Test Suites | Rust module paths | api::authentication |
| Test Cases | Individual tests | rejects_invalid_token |
Doctests use a separate module such as store::doctest/store. Their names include the source location, so moving an example can change its identity.
Doctests and durations#
Doctests run with your usual test command, including compile_fail, should_panic, and no_run examples. To run only doctests:
tuist cargo test --doc
Stable libtest reports whole-suite time but not individual test durations. Unavailable timings are excluded from per-case duration histories and duration analytics, while test outcomes still contribute to reliability and run counts.
Reporting limits#
Individual results are collected from Cargo/libtest's default output. Commands using --no-run, --list, quiet or Cargo-verbose output, alternate formats, or uncaptured test output run normally without individual test reporting. Custom harnesses, incomplete summaries, ambiguous target attribution, and oversized reports are not uploaded.
If workspace packages have identically named integration targets, select one with -p <package>. Reporting supports exact workspace package names; dependency packages, version-qualified selectors, and globs execute normally but are not reported. Absolute doctest paths are omitted to keep checkout paths out of test identities.
Tuist streams output while collecting results. This can affect automatic color detection. Background processes that keep output pipes open after Cargo exits can cause the report to be omitted, but do not change Cargo's exit status.
Reliability and selection#
Use flaky test detection and quarantine to investigate unstable tests and mute or skip them. Test sharding distributes whole Cargo targets across CI workers. Turn on code coverage to follow the line coverage of your test runs. Coverage-based test selection and build-once distribution are not available for plain Cargo test runs.
Troubleshooting#
If a test run doesn't appear in the dashboard, enable debug output to see why its report wasn't sent:
TUIST_DEBUG=1 tuist cargo test --workspace