Rust Cargo Test configuration
The allure-cargotest integration is configured through environment variables.
ALLURE_RESULTS_DIR
Overrides the default directory where #[allure_test] writes Allure results.
When unset, allure-cargotest uses target/allure-results.
ALLURE_RESULTS_DIR=./allure-results cargo testALLURE_HOST_NAME
Overrides the host label that allure-cargotest adds automatically.
If this variable is not set, the adapter tries to detect the host name from the current machine.
ALLURE_HOST_NAME=ci-linux-01 cargo testALLURE_THREAD_NAME
Overrides the thread label that allure-cargotest adds automatically.
If this variable is not set, the adapter uses the current thread name or thread ID.
ALLURE_THREAD_NAME=worker-1 cargo testALLURELABEL*
Adds global labels to every test result.
Any environment variable whose name starts with ALLURE_LABEL_ becomes an Allure label. For example:
ALLURE_LABEL_epic="Web interface" \
ALLURE_LABEL_owner="QA Team" \
cargo testThis applies the epic and owner labels to every test in the run.
allure.label.*
Adds global labels using the alternative naming scheme that some CI tools already use.
Any environment variable whose name starts with allure.label. is treated the same way as ALLURE_LABEL_*.
allure.label.layer=e2e cargo testALLURE_TESTPLAN_PATH
Points to a JSON file that defines which tests should run.
The file uses the standard Allure test plan shape:
{
"version": "1.0",
"tests": [{ "id": "AUTH-1" }, { "selector": "auth::tests::login_works" }]
}Run the tests with:
ALLURE_TESTPLAN_PATH=./testplan.json cargo testSelection works as follows:
- entries with
idmatch tests that expose an Allure ID, for example via#[allure_test(id = "AUTH-1")], - entries with
selectormatch the full Rust test name, including its module path.
If ALLURE_TESTPLAN_PATH is unset, the file does not exist, or the JSON is malformed, allure-cargotest skips filtering and runs the tests normally.
Automatic labels added by allure-cargotest
When you use #[allure_test] or CargoTestReporter, allure-cargotest adds a few labels automatically:
language = rustframework = cargo-testhostthread
It also derives suite labels from the Rust module path:
- a single module segment becomes
suite, - two segments become
parentSuiteandsuite, - three or more segments become
parentSuite,suite, andsubSuite.
Explicit calls to allure.parent_suite(...), allure.suite(...), or allure.sub_suite(...) override the automatically derived labels with the same name.