Glossary¶
This page defines key terms and identifiers used throughout nextest.
Run ID¶
A run ID is a UUID that uniquely identifies a single invocation of cargo nextest run. Every test and setup script executed within that run shares the same run ID.
Run IDs are useful for:
- Correlating logs and events across tests within the same run.
- Distinguishing between different test runs in external systems.
The run ID is available:
-
During
cargo nextest run, at the beginning of the test run. For example:Nextest run ID 1f79aa0d-4ec8-4a5c-aa83-5e8dc2f36573 with nextest profile: default Starting 14 tests across 3 binaries (177 tests skipped) ...
- Via the
NEXTEST_RUN_IDenvironment variable. - In JUnit output, via the
uuidattribute on the roottestsuiteselement. - 0.9.108 In USDT probes, through
arg1forrun-*events, and also JSON-encoded inarg0as therun_idfield.
Binary ID¶
A binary ID uniquely identifies a test binary within a Cargo workspace. The format depends on the type of binary:
| Binary type | Format | Example |
|---|---|---|
Unit test (from lib.rs) |
crate-name |
my-crate |
| Integration test | crate-name::bin-name |
my-crate::integration |
| Other (benchmark, example, etc.) | crate-name::kind/bin-name |
my-crate::bench/perf |
For more about unit and integration tests, see the documentation for cargo test.
The binary ID is available:
-
During
cargo nextest run, as the first part of each test execution line. For example:PASS [ 0.014s] nextest-runner reporter::tests::on_test_finished_dont_store_final ^^^^^^^^^^^^^^ binary id
-
In
cargo nextest listoutput, as section headings. For example:nextest-runner: <-- binary id config::nextest_version::tests::test_valid_nextest_version::basic config::nextest_version::tests::test_valid_nextest_version::basic_with_patch ...
- 0.9.116 Via the
NEXTEST_BINARY_IDenvironment variable.
- In JUnit output, via the
nameattribute on eachtestsuiteelement.
- 0.9.108 In USDT probes, JSON-encoded in
arg0as thebinary_idfield.
Within filtersets, binary IDs can be selected via the binary_id predicate.
Attempt ID¶
An attempt ID uniquely identifies a single execution attempt of a test. When tests are retried, each retry is a separate attempt with its own attempt ID. If you're collecting data by individual test execution, an attempt ID is a suitable, globally unique map key.
An attempt ID is comprised of:
- The run ID
- The binary ID
- For stress tests, the 0-indexed stress index (not included if this is not a stress run)
- The test name
- The current attempt number, if the test is being retried (not included if this is the first attempt)
An example attempt ID is:
55459fda-13fe-406a-b4e3-0230fd52bb03:nextest_runner::integration@stress-3$basic::retry_overrides_ignored#2
Here:
55459fda-13fe-406a-b4e3-0230fd52bb03is the run ID.nextest_runner::integrationis the binary ID.stress-3is the stress index (the 4th stress iteration).basic::retry_overrides_ignoredis the test name.2is the attempt number (indicating this is the 2nd attempt).
The attempt ID is available:
- 0.9.116 Via the
NEXTEST_ATTEMPT_IDenvironment variable. - 0.9.108 In USDT probes, through
arg1fortest-attempt-*events, and also JSON-encoded inarg0as theattempt_idfield.
Slot numbers¶
Nextest assigns each running test a global slot number. Additionally, if a test is in a test group, the test is also assigned a group slot number.
Slot numbers are non-negative integers starting from 0. They are useful for assigning resources such as blocks of port numbers to tests.
Slot numbers are:
- Unique for the lifetime of the test: no other concurrently running test will have the same global slot number, and no other concurrently running test in the same group will have the same group slot number.
- Stable across retries within the same run (though not across runs).
- Compact: each test is assigned the smallest available slot number at the time it starts. For example, if a test group is limited to serial execution, the group slot number is always 0.
The global slot number is available:
- Via the
NEXTEST_TEST_GLOBAL_SLOTenvironment variable. - 0.9.108 In USDT probes, JSON-encoded in
arg0as theglobal_slotfield.
The group slot number is available:
- Via the
NEXTEST_TEST_GROUP_SLOTenvironment variable. (If a test is not within a group,NEXTEST_TEST_GROUP_SLOTis set tonone.) - 0.9.108 In USDT probes, JSON-encoded in
arg0as thegroup_slotfield. (If a test is not within a group, this isnull.)