---
title: Rust Cargo Test configuration
description: Configuration options for the allure-cargotest integration | Change the results directory | Set global labels | Select tests via a test plan
---

# Rust Cargo Test configuration

The [`allure-cargotest`](/docs/rust/) 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`.

```bash
ALLURE_RESULTS_DIR=./allure-results cargo test
```

## ALLURE_HOST_NAME

Overrides the `host` label that `allure-cargotest` adds automatically.

If this variable is not set, the integration tries to detect the host name from the current machine.

```bash
ALLURE_HOST_NAME=ci-linux-01 cargo test
```

## ALLURE_THREAD_NAME

Overrides the `thread` label that `allure-cargotest` adds automatically.

If this variable is not set, the integration uses the current thread name or thread ID.

```bash
ALLURE_THREAD_NAME=worker-1 cargo test
```

## ALLURE*LABEL*\*

Adds global labels to every test result.

Any environment variable whose name starts with `ALLURE_LABEL_` becomes an Allure label. For example:

```bash
ALLURE_LABEL_epic="Web interface" \
ALLURE_LABEL_owner="QA Team" \
cargo test
```

This 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_*`.

```bash
allure.label.layer=e2e cargo test
```

## ALLURE_TESTPLAN_PATH

Points to a JSON file that defines which tests should run.

The file uses the standard Allure test plan shape:

```json
{
  "version": "1.0",
  "tests": [{ "id": "AUTH-1" }, { "selector": "auth::tests::login_works" }]
}
```

Run the tests with:

```bash
ALLURE_TESTPLAN_PATH=./testplan.json cargo test
```

Selection works as follows:

- entries with `id` match tests that expose an Allure ID, for example via `#[allure_test(id = "AUTH-1")]`,
- entries with `selector` match 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 = rust`
- `framework = cargo-test`
- `host`
- `thread`

It also derives suite labels from the Rust module path:

- a single module segment becomes `suite`,
- two segments become `parentSuite` and `suite`,
- three or more segments become `parentSuite`, `suite`, and `subSuite`.

Explicit calls to `allure.parent_suite(...)`, `allure.suite(...)`, or `allure.sub_suite(...)` override the automatically derived labels with the same name.
