---
title: xUnit.net configuration
description: Configuration for Allure xUnit.net | Change allure-results directory | Configure link patterns | Configure broken test detection
---

# Allure xUnit.net configuration

This page describes the configuration options that affect the behavior of [Allure xUnit.net](/docs/xunit/).

By default, Allure xUnit.net tries to read the `allureConfig.json` file in the same directory where the test assembly is located. To make sure the file is present there, edit the file properties in your IDE or manually in your `*.csproj` file and set the corresponding item's `CopyToOutputDirectory` to either `Always` or `PreserveNewest`. For example:

```xml
<Project Sdk="Microsoft.NET.Sdk">
    <!-- ... -->
    <ItemGroup>
        <None Update="specflow.json">
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </None>
    </ItemGroup>
</Project>
```

Alternatively, use the `ALLURE_CONFIG` environment variable to specify a relative or absolute path of the configuration file.

## allure.directory

Path to the directory where Allure xUnit.net will save the test results, see [How it works](/docs/how-it-works/). If the directory does not exist, it will be created. Defaults to `allure-results`.

Note that the path is treated as relative to the build output directory of the project. When building and running tests from an IDE, this is typically different from the solution folder. Multiple `../` elements may be needed if you want to put the test results into a directory in the solution folder.

```json
{
  "allure": {
    "directory": "../../../../../allure-results"
  }
}
```

## allure.links

List of patterns that can be used to construct full URLs from short identifiers.

Each pattern must be a string containing a placeholder surrounded by curly brackets, for example: `{issue}`. When processing a link, Allure xUnit.net selects the pattern whose placeholder matches the link type (as specified using the [`Link` or `[AllureLink]`](/docs/xunit-reference/#link) arguments). The placeholder is then replaced by the short identifier.

For example, with the configuration below, the link `BUG-123` of type `issue` will be translated to `https://issues.example.com/BUG-123`.

```json
{
  "allure": {
    "links": [
      "https://issues.example.com/{issue}",
      "https://tms.example.com/{tms}",
      "https://jira.example.com/browse/{jira}"
    ]
  }
}
```

## allure.xunitRunnerReporter

The secondary reporter that should be used alongside Allure xUnit.net.

Allowed values are:

- `auto` (the default) — select a secondary reporter automatically, similar to how a test runner selects a reporter. This will only select among the xUnit.net reporters that are “environmentally enabled”.

  If there are no environmentally enabled reporters other than Allure xUnit.net, this value is identical to `none`.

  If there is only one environmentally enabled reporter other than Allure xUnit.net, this value is identical to specifying its reporter switch explicitly.

  In all other cases, Allure xUnit.net will select one of the environmentally enabled reporters, but the algorithm of this selection is not determined.

- `none` — do not use a secondary reporter.

- the [reporter switch](https://xunit.net/docs/runsettings#ReporterSwitch) of the reporter, e.g., `teamcity`.

- the fully qualified name of the reporter class, e.g. `Xunit.Runner.Reporters.TeamCityReporter, xunit.runner.reporters.netcoreapp10, Version=2.5.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c`. Note that the fully qualified name is often framework-dependent and changes for each new version of the reporter. Because of that, using the fully qualified name is not recommended for most cases. However, it may be useful for large projects, where selection by the reporter switch would significantly slow down the startup.

```json
{
  "allure": {
    "xunitRunnerReporter": "teamcity"
  }
}
```

## allure.failExceptions

A list of exception types which, when thrown from a [step](/docs/xunit-reference/#test-steps), should cause it to have the [Failed](/docs/test-statuses/#failed) status. In case of any other exception, the [Broken](/docs/test-statuses/#broken) status is assigned to the step.

Notes:
Currently, the setting only affects the statuses of individual test steps. For the status of a test as a whole, see [Distinguish between test statuses](/docs/xunit/#distinguish-between-test-statuses).

The default list includes the `Xunit.Sdk.XunitException` class and the `Xunit.Sdk.IAssertionException` interface. The setting, if not empty, overrides the default list. When looking for matches, Allure xUnit.net uses not only the exception class's own full name but also all its interfaces and base classes.

With the example configuration below, a step will be considered failed if it throws `Xunit.Sdk.IAssertionException`, `MyNamespace.MyCustomException`, or anything that derives from them. At the same time, any other exception will make the step broken.

```json
{
  "allure": {
    "failExceptions": ["Xunit.Sdk.IAssertionException", "MyNamespace.MyCustomException"]
  }
}
```
