---
title: Reqnroll reference
description: Reference documentation for Allure Reqnroll integration | How to add sub-steps and additional metadata | Create attachments | Organise tests
---

# Allure Reqnroll reference

These are the attributes and methods that you can use to integrate your Reqnroll tests with Allure Report.

In most cases, you need to indicate to Allure Reqnroll that a certain property needs to be assigned to the test result. Most properties can be assigned via Gherkin tags or via the Runtime API.

- **Gherkin tags**: use [Gherkin tags](https://docs.reqnroll.net/latest/gherkin/gherkin-reference.html#tags) to assign various data to a particular `Scenario` or a whole `Feature`. You can configure the patterns for such conversion via regular expressions in the [configuration file](/docs/reqnroll-configuration/).

  Note that due to a limitation in the Gherkin syntax, a tag cannot contain spaces.

  When using this approach, the data is guaranteed to be added to the test result regardless of how the test itself runs.

- **Runtime API**: use Allure's functions to add data to the test result during the execution of its steps. This approach allows for constructing the data dynamically.

  Note that it is recommended to call the Allure's functions as close to the beginning of the test as possible. This way, the data will be added even if the test fails early.

## Metadata

Assign a test's [description, links and other metadata](/docs/v2/readability/#description-links-and-other-metadata).

### Title

- `AllureApi.SetTestName(string name)`

Set the test's [title](/docs/v2/readability/#title).

```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.SetTestName("Open labels page");
        // ...
    }
}
```

### Description

- `AllureApi.SetDescription(string description)`

Set the test's [description](/docs/v2/readability/#description).

Allure Reqnroll uses a scenario's description from the Gherkin file, if present. Alternatively, use Runtime API to set the description dynamically.

Markdown formatting is allowed. Any HTML formatting, if present, will be stripped for security purposes.

**Gherkin description:**
```gherkin
Feature: Labels

  Scenario: Create new label for authorized user
  This test attempts to create a label with specified title

    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```java
[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.SetDescription("This test attempts to create a label with specified title");
        // ...
    }
}
```

### Owner

- `@allure.owner:⟨VALUE⟩`
- `AllureApi.SetOwner(string owner)`

Set the test's [owner](/docs/v2/readability/#owner).

The format for the Gherkin tags is configured via the [`allure.gherkinPatterns.metadata.owner`](/docs/reqnroll-configuration/#allure-gherkinpatterns-metadata) option.

**Gherkin tags:**
```gherkin
@allure.owner:JohnDoe
Feature: Labels

  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void ThenLabels()
    {
        AllureApi.SetOwner("John Doe");
        // ...
    }
}
```

### Tag

- `AllureApi.AddTags(params string[] tags)`

Set the test's [tags](/docs/v2/readability/#tags).

Any [Gherkin tag](https://docs.reqnroll.net/latest/gherkin/gherkin-reference.html#tags) is automatically added to the list of the test's tags, unless it matches one of the regular expressions in the [configuration](/docs/reqnroll-configuration/).

**Gherkin tags:**
```gherkin
@UI @Labels
Feature: Labels

  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.AddTags("UI", "Labels");
        // ...
    }
}
```

### Severity

- `AllureApi.SetSeverity(SeverityLevel severity)`

Set the test's [severity](/docs/v2/readability/#severity).

The format for the Gherkin tags is configured via the [`allure.gherkinPatterns.metadata.severity`](/docs/reqnroll-configuration/#allure-gherkinpatterns-metadata) option.

**Gherkin tags:**
```gherkin
Feature: Labels

  @critical
  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.SetSeverity(SeverityLevel.critical);
        // ...
    }
}
```

### Label

- `@allure.label.⟨NAME⟩:⟨VALUE⟩`
- `AllureApi.AddLabel(string name, string value)`
- `AllureApi.AddLabel(Label label)`
- `AllureApi.AddLabels(params Label[] labels)`

Set an arbitrary [label](/docs/v2/readability/#other-labels) for the test. This is the underlying implementation for a lot of Allure's other APIs.

The format for the Gherkin tags is configured via the [`allure.gherkinPatterns.metadata.label`](/docs/reqnroll-configuration/#allure-gherkinpatterns-metadata) option.

**Gherkin tags:**
```gherkin
@allure.label.layer:web
@allure.label.owner:eroshenkoam
@allure.label.page:/{org}/{repo}/labels
@allure.label.jira:AE-2
Feature: Labels

  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.AddLabel("layer", "web");
        AllureApi.AddLabel("owner", "eroshenkoam");
        AllureApi.AddLabel("page", "/{org}/{repo}/labels");
        AllureApi.AddLabel("jira", "AE-2");
        // ...
    }
}
```

### Allure ID (Allure TestOps)

- `@allure.label.allure_id:⟨VALUE⟩`

Set the test's [ID](/docs/v2/readability/#id).

The format for the Gherkin tags is configured via the [`allure.gherkinPatterns.metadata.label`](/docs/reqnroll-configuration/#allure-gherkinpatterns-metadata) option. In the tag, use `allure_id` as the label name.

**Gherkin tags:**
```gherkin
Feature: Labels

  @allure.label.allure_id:123
  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

### Link

- `@allure.link:⟨URL⟩`
- `@allure.issue:⟨URL⟩`
- `@allure.tms:⟨URL⟩`
- `AllureApi.AddLink(string url)`
- `AllureApi.AddLink(string name, string url)`
- `AllureApi.AddLink(string name, string type, string url)`
- `AllureApi.AddLinks(params Link[] links)`
- `AllureApi.AddIssue(string url)`
- `AllureApi.AddIssue(string name, string url)`
- `AllureApi.AddTmsItem(string url)`
- `AllureApi.AddTmsItem(string name, string url)`

Add a [link](/docs/v2/readability/#links) related to the test.

Based on the `type` (which can be any string; defaults to “link”), Allure will try to load a corresponding **link pattern** to process the URL, as defined by the [`allure.links`](/docs/reqnroll-configuration/#allure-links) section of the configuration file. If no pattern found for the given type, the URL is left unmodified.

The `name` will be used as the link's text. If it is omitted, the unprocessed URL will be used instead.

Additionally, you can use the [`allure.gherkinPatterns.links`](/docs/reqnroll-configuration/#allure-gherkinpatterns-links) section of the configuration file to specify formats for adding “link”, “issue” and “tms” links via Gherkin tags.

**Gherkin tags:**
```gherkin
@allure.link:https://dev.example.com/
@allure.issue:UI-123
@allure.tms:TMS-456
Feature: Labels

  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.AddLink("Website", "https://dev.example.com/");
        AllureApi.AddIssue("UI-123");
        AllureApi.AddTmsItem("TMS-456");
        // ...
    }
}
```

## Behavior-based hierarchy

- `@allure.epic:⟨VALUE⟩`
- `@allure.story:⟨VALUE⟩`
- `AllureApi.AddEpic(string epic)`
- `AllureApi.AddFeature(string feature)`
- `AllureApi.AddStory(string story)`

Assign names of **epics**, **features** or **user stories** for a test, as part of Allure's [behavior-based hierarchy](/docs/v2/navigation/#behavior-based-hierarchy).

The format for the Gherkin tags is configured via the [`allure.gherkinPatterns.grouping.behaviors`](/docs/reqnroll-configuration/#allure-gherkinpatterns-grouping-behaviors) options.

**Gherkin tags:**
```gherkin
@allure.epic:WebInterface
Feature: Labels

  @allure.story:CreateLabels
  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.AddEpic("Web interface");
        AllureApi.AddFeature("Essential features");
        AllureApi.AddStory("Labels");
        // ...
    }
}
```

## Suite-based hierarchy

- `@allure.parentSuite:⟨VALUE⟩`
- `@allure.suite:⟨VALUE⟩`
- `@allure.subSuite:⟨VALUE⟩`
- `AllureApi.AddParentSuite(string parentSuite)`
- `AllureApi.AddSuite(string suite)`
- `AllureApi.AddSubSuite(string subSuite)`

Assign the names of **parent suite**, **suite** or **sub-suite** for a test, as part of Allure's [suite-based hierarchy](/docs/v2/navigation/#suite-based-hierarchy).

The format for the Gherkin tags is configured via the [`allure.gherkinPatterns.grouping.suites`](/docs/reqnroll-configuration/#allure-gherkinpatterns-grouping-suites) options.

**Gherkin tags:**
```gherkin
@allure.parentSuite:WebInterface
@allure.suite:EssentialFeatures
@allure.subSuite:Labels
Feature: Labels

  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"
```

**Runtime API:**
```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.AddParentSuite("Web interface");
        AllureApi.AddSuite("Essential features");
        AllureApi.AddSubSuite("Labels");
        // ...
    }
}
```

## Test steps

- `AllureApi.Step(string name)`
- `AllureApi.Step(string name, Action acti`
- `T AllureApi.Step<T>(string name, Func<T> function)`
- `async Task AllureApi.Step(string name, Func<Task> action)`
- `async Task<T> AllureApi.Step<T>(string name, Func<Task<T>> function)`

Define a [test sub-steps](/docs/steps/) with the given `name`.

There are two ways of defining a sub-step.

- **Lambda sub-steps**

  Write a test sub-step in a lambda function and pass it to `Step()`. If the lambda function returns a value, `Step()` will return it without modification, and it will not affect the report.

  Use `AllureLifecycle.Instance.UpdateStep()` to add custom parameters to the current sub-step, as shown in the example below.

- **No-op sub-steps**

  If you call `Step()` with a name but without a lambda function, Allure will add to the report a no-op sub-step. This allows for a log-style reporting within a larger step. A no-op sub-step finishes immediately after it started and cannot have any parameters, attachments or sub-steps of its own.

In the example below, a new lambda sub-step is created at runtime for each URL from a list. The URL is added to the list of the sub-step's parameters. Within each of the sub-steps, a sequence of three no-op sub-steps occurs.

```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [Then("visit pages")]
    public void ThenVisitPages()
    {
        string[] urls =
        {
            "https://domain1.example.com/",
            "https://domain2.example.com/"
        };

        foreach (string url in urls)
        {
            AllureApi.Step($"Test {url}", () =>
            {
                AllureLifecycle.Instance.UpdateStep(stepResult =>
                {
                    stepResult.parameters.Add(
                        new Parameter { name = "Webpage URL", value = url }
                    );
                });

                AllureApi.Step("Opening web browser...");
                // ...

                AllureApi.Step($"Visiting {url}...");
                // ...

                AllureApi.Step("Closing web browser...");
                // ...
            });
        }
    }
}
```

## Parametrized tests

Allure Reqnroll support multiple ways of implementing the [parametrized tests](/docs/v2/readability/#parametrized-tests) pattern:

- [scenario outlines](#scenario-outlines),
- [vertical data tables](#vertical-data-tables),
- [horizontal data tables](#horizontal-data-tables),
- [runtime parameters](#runtime-parameters).

### Scenario outlines

In Gherkin, a [`Scenario Outline`](https://docs.reqnroll.net/latest/gherkin/gherkin-reference.html#scenario-outline) (or a `Scenario Template`) implements the [parametrized tests](/docs/v2/readability/#parametrized-tests) pattern. A scenario outline must contain an `Examples` table, from which Reqnroll loads sets of parameters, one row after another. Each set of parameters is being placed into the step declarations according to the placeholders, thus generating a new scenario based on the row. Reqnroll then runs each of them independently, as if it was a separate `Scenario`. The data can then be captured by a regular expression and passed as separate arguments to the C# code.

Allure Reqnroll automatically recognizes this pattern. No additional configuration is required.

The example below shows a Gherkin file and a C# implementation file of a test. In this example, the four parameters for the “I enter my details...” step will be displayed in both instances of the scenario in the test report.

```gherkin
Feature: User management

  Scenario Outline: Registration
    When I go to the registration form
    And I enter my details: <login>, <password>, <name>, <birthday>
    Then the profile should be created

    Examples:
      | login   | password | name     | birthday   |
      | johndoe | qwerty   | John Doe | 1970-01-01 |
      | janedoe | 123456   | Jane Doe | 1111-11-11 |
```

```csharp
using System;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I go to the registration form")]
    public void WhenIGoToTheRegistrationForm()
    {
        // ...
    }

    [When(@"I enter my details: (.*), (.*), (.*), (.*)")]
    public void WhenIEnterMyDetails(
        string login, string password, string name, DateTime birthday)
    {
        // ...
    }

    [Then("the profile should be created")]
    public void ThenTheProfileShouldBeCreated()
    {
        // ...
    }
}
```

### Vertical data tables

If your Gherkin step declaration contains a [data table](https://docs.reqnroll.net/latest/gherkin/gherkin-reference.html#data-tables) with **two columns**, Allure Reqnroll can display its content as the step-level parameters. This behavior is only applied when the table columns are named in a certain way, e.g., “Parameter” and “Value”.

The functionality is optional. To enable it, edit the [`allure.gherkinPatterns.stepArguments`](/docs/reqnroll-configuration/#allure-gherkinpatterns-steparguments) section of the configuration file, including the regular expressions for the headers.

The table data itself is passed to the C# code without modifications.

The example below shows a configuration file, a Gherkin file and a C# implementation file of a test. In this example, the four parameters for the “I enter my details” step will be displayed in the test report.

```json
{
  "allure": {
    "gherkinPatterns": {
      "stepArguments": {
        "createFromDataTables": true,
        "nameColumn": "^Parameter$",
        "valueColumn": "^Value$"
      }
    }
  }
}
```

```gherkin
Feature: User management

  Scenario: Registration
    When I go to the registration form
    And I enter my details
      | Parameter | Value      |
      | login     | johndoe    |
      | password  | qwerty     |
      | name      | John Doe   |
      | birthday  | 1970-01-01 |
    Then the profile should be created
```

```csharp
using Reqnroll;

[Binding]
public class Steps
{
    [When("I go to the registration form")]
    public void WhenIGoToTheRegistrationForm()
    {
        // ...
    }

    [When("I enter my details")]
    public void WhenIEnterMyDetails(Table table)
    {
        // ...
    }

    [Then("the profile should be created")]
    public void ThenTheProfileShouldBeCreated()
    {
        // ...
    }
}
```

### Horizontal data tables

If your Gherkin step declaration contains a [data table](https://docs.reqnroll.net/latest/gherkin/gherkin-reference.html#data-tables) with **one row**, Allure Reqnroll can display its content as the step-level parameters.

The functionality is optional. To enable or disable it, edit the [`allure.gherkinPatterns.stepArguments.createFromDataTables`](/docs/reqnroll-configuration/#allure-gherkinpatterns-steparguments) configuration option.

The table data itself is passed to the C# code without modifications.

The example below shows a configuration file, a Gherkin file and a C# implementation file of a test. In this example, the four parameters for the “I enter my details” step will be displayed in the test report.

```json
{
  "allure": {
    "gherkinPatterns": {
      "stepArguments": {
        "createFromDataTables": true,
        "nameColumn": "^Parameter$",
        "valueColumn": "^Value$"
      }
    }
  }
}
```

```gherkin
Feature: User management

  Scenario: Registration
    When I go to the registration form
    And I enter my details
      | login   | password | name     | birthday   |
      | johndoe | qwerty   | John Doe | 1970-01-01 |
    Then the profile should be created
```

```csharp
using Reqnroll;

[Binding]
public class Steps
{
    [When("I go to the registration form")]
    public void WhenIGoToTheRegistrationForm()
    {
        // ...
    }

    [When("I enter my details")]
    public void WhenIEnterMyDetails(Table table)
    {
        // ...
    }

    [Then("the profile should be created")]
    public void ThenTheProfileShouldBeCreated()
    {
        // ...
    }
}
```

### Runtime parameters

- `AllureApi.AddTestParameter(string name, object? value)`
- `AllureApi.AddTestParameter(string name, object? value, ParameterMode mode)`
- `AllureApi.AddTestParameter(string name, object? value, bool excluded)`
- `AllureApi.AddTestParameter(string name, object? value, ParameterMode mode, bool excluded)`
- `AllureApi.AddTestParameter(Parameter parameter)`

The `AddTestParameter()` function can be used at any point, even if the Gherkin file does not specify actual parameters or data tables to any step.

If the `excluded` argument is set to true, Allure will not use the parameter when comparing the current test result with previous one in the history. This argument is only used by Allure TestOps.

The `mode` argument affects how the parameter will be displayed in the report. Available options are defined in the `ParameterMode` enumeration:

- `ParameterMode.Default` (same as not specifying any mode) — the parameter and its value will be shown in a table along with other parameters.
- `ParameterMode.Masked` — the parameter will be shown in the table, but its value will be hidden. Use this mode for passwords, tokens and other sensitive parameters.
- `ParameterMode.Hidden` — the parameter and its value will not be shown in the test report. Note, however, that it is still possible to extract the value from the `allure_results` directory if you publish it.

The example below shows a Gherkin file and a C# implementation file of a test. As far as Reqnroll is concerned, the “I enter my details” in the example does not have any data passed to it, however, Allure will have the four parameters displayed on the test level.

```gherkin
Feature: User management

  Scenario: Registration
    When I go to the registration form
    And I enter my details
    Then the profile should be created
```

```csharp
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I go to the registration form")]
    public void WhenIGoToTheRegistrationForm()
    {
        // ...
    }

    [When("I enter my details")]
    public void WhenIEnterMyDetails()
    {
        AllureApi.AddTestParameter("login", "johndoe");
        AllureApi.AddTestParameter("password", "qwerty");
        AllureApi.AddTestParameter("name", "John Doe");
        AllureApi.AddTestParameter("birthday", "1970-01-01");
        // ...
    }

    [Then("the profile should be created")]
    public void ThenTheProfileShouldBeCreated()
    {
        // ...
    }
}
```

## Attachments

- `AllureApi.AddAttachment(string name, string type, string path)`
- `AllureApi.AddAttachment(string name, string type, byte[] content, string fileExtension = "")`
- `AllureApi.AddAttachment(string path, string? name = null)`
- `AllureApi.AddScreenDiff(string expectedPng, string actualPng, string diffPng)`

Add an [attachment](/docs/attachments/) to the test result under the given `name`.

Tip:
You can use data produced by any function, not necessarily read from an actual file.

To create an attachment using the Runtime API, call `AddAttachment()` at any point during your test. Pass either the `content` or the `path` from which the data will be read.

To ensure that the reader's web browser will display attachments correctly, it is recommended to specify each attachment's type. To do so, pass the media type of the content as `type` and, optionally, a filename extension as `fileExtension`. The media type affects how the data will be displayed in the test report, while the filename extension is appended to the filename when user wants to save the file.

```csharp
using System.IO;
using System.Text;
using Allure.Net.Commons;
using Reqnroll;

[Binding]
public class Steps
{
    [When("I open labels page")]
    public void TestLabels()
    {
        AllureApi.AddAttachment(
            "data.txt",
            "text/plain",
            Encoding.UTF8.GetBytes("This is the file content.")
        );
        AllureApi.AddAttachment(
            "image1.png",
            "image/png",
            File.ReadAllBytes("/path/to/image1.png")
        );
        AllureApi.AddAttachment(
            "image2.png",
            "image/png",
            "/path/to/image2.png"
        );
    }
}
```

Allure Reqnroll also provides a dedicated `AddScreenDiff()` function for attaching [visual comparisons](/docs/attachments/#attaching-visual-comparisons).
