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

# Allure SpecFlow configuration

This page describes the configuration options that affect the behavior of [Allure SpecFlow](/docs/specflow/).

Warning:
SpecFlow has [reached its end of life](https://support-hub.tricentis.com/open?number=NEW0001432&id=post). We recommend you migrate to [Reqnroll](https://reqnroll.net/) and use [Allure Reqnroll](/docs/reqnroll/).

By default, Allure SpecFlow 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="allureConfig.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 SpecFlow 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 SpecFlow selects the pattern whose placeholder matches the link type (as specified using the [`Link`](/docs/specflow-reference/#link) arguments or the [`specflow.links`](#specflowlinks) patterns). 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.failExceptions

A list of exception types representing assertion failures.

In case of an exception that matches one of the listed classes, the [Failed](/docs/test-statuses/#failed) status is assigned to the test, step, or fixture. In case of any other exception, the [Broken](/docs/test-statuses/#broken) status is assigned. When looking for matches, Allure SpecFlow uses not only the exception class's own full name but also all its interfaces and base classes.

The default list includes the base classes and interfaces that could be thrown by various runners compatible with SpecFlow: `NUnit.Framework.AssertionException`, `Xunit.Sdk.IAssertionException`, `Xunit.Sdk.XunitException`, `Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException`. The setting, if not empty, overrides the default list.

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

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

## specflow.stepArguments

Configuration options that affect how Allure SpecFlow processes data tables found in Gherkin files.

The `convertToParameters` option defines whether Allure SpecFlow will support the [Vertical data tables](/docs/specflow-reference/#vertical-data-tables) and [Horizontal data tables](/docs/specflow-reference/#horizontal-data-tables) approaches.

For the vertical data tables, the `paramNameRegex` and `paramValueRegex` regular expressions, if provided, are used to check whether a table should be considered a list of step parameters or not.

For example, with the configuration below, a two-columns table with the columns “Parameter” and “Value” will be processed, but a table with any other columns won't, even if there happens to be two of them.

```json
{
  "specflow": {
    "stepArguments": {
      "convertToParameters": true,
      "paramNameRegex": "^Parameter$",
      "paramValueRegex": "^Value$"
    }
  }
}
```

## specflow.grouping.behaviors

Regular expressions for Gherkin tags that can be used to set a test's epic and story, as part of Allure's [behavior-based hierarchy](/docs/v2/navigation/#behavior-based-hierarchy).

For example, with the configuration below, a feature with the Gherkin tag `@allure.label.epic:UI` will be added to the “UI” epic.

```json
{
  "specflow": {
    "grouping": {
      "behaviors": {
        "epic": "^allure.label.epic:(.+)$",
        "story": "^allure.label.story:(.+)$"
      }
    }
  }
}
```

## specflow.grouping.suites

Regular expressions for Gherkin tags that can be used to set a test's suites, as part of Allure's [suite-based hierarchy](/docs/v2/navigation/#suite-based-hierarchy).

For example, with the configuration below, a feature with the Gherkin tag `@allure.label.suite:TestUI` will be added to the “TestUI” suite.

```json
{
  "specflow": {
    "grouping": {
      "suites": {
        "parentSuite": "^allure.label.parentSuite:(.+)$",
        "suite": "^allure.label.suite:(.+)$",
        "subSuite": "^allure.label.subSuite:(.+)$"
      }
    }
  }
}
```

## specflow.grouping.packages

Regular expressions for Gherkin tags that can be used to set a test's package, class and method, as part of Allure's [package-based hierarchy](/docs/v2/navigation/#package-based-hierarchy).

For example, with the configuration below, a feature with the Gherkin tag `@allure.label.package:org.example.testui` will be added to the “org.example.testui” package.

```json
{
  "specflow": {
    "grouping": {
      "packages": {
        "package": "^allure.label.package:(.+)$",
        "testClass": "^allure.label.class:(.+)$",
        "testMethod": "^allure.label.method:(.+)$"
      }
    }
  }
}
```

## specflow.labels

Regular expressions for Gherkin tags that can be used to add an arbitrary [label](/docs/specflow-reference/#label) for the test, as well as its [owner](/docs/specflow-reference/#owner) and [severity](/docs/specflow-reference/#severity) specifically.

The `label` regular expression must contain two capture groups. The two captured texts will be used as the name and the value for the label.

The `owner` and `severity` regular expressions must contain one capture group. The captured text will be used as the value for the label.

For example, with the configuration below:

- the Gherkin tag `@allure.label.language=csharp` will add a label with the name “language” and the value “csharp”,
- the Gherkin tag `@allure.label.owner:JohnDoe` will set the test's owner to “JohnDoe”,
- the Gherkin tag `@critical` will set the test's severity to “critical”.

```json
{
  "specflow": {
    "labels": {
      "label": "^allure.label.(.+):(.+)$"
      "owner": "^allure.label.owner:(.+)$",
      "severity": "^(normal|blocker|critical|minor|trivial)$",
    }
  }
}
```

## specflow.links

Regular expressions for Gherkin tags that can be used to add a [link](/docs/specflow-reference/#link) of one of the standard types: “link”, “issue”, or “tms”.

For example, with the configuration below, the Gherkin tag `@issue:BUG-123` will add a link “BUG-123” of type “issue”. Optionally, it can then be processed according to the [`allure.links`](#allurelinks) patterns.

```json
{
  "specflow": {
    "links": {
      "link": "^link:(.+)",
      "issue": "^issue:(.+)",
      "tms": "^tms:(.+)"
    }
  }
}
```
