Allure.SpecFlow 2.9.2-preview.1

This is a prerelease version of Allure.SpecFlow.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Allure.SpecFlow --version 2.9.2-preview.1
NuGet\Install-Package Allure.SpecFlow -Version 2.9.2-preview.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Allure.SpecFlow" Version="2.9.2-preview.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Allure.SpecFlow --version 2.9.2-preview.1
#r "nuget: Allure.SpecFlow, 2.9.2-preview.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Allure.SpecFlow as a Cake Addin
#addin nuget:?package=Allure.SpecFlow&version=2.9.2-preview.1&prerelease

// Install Allure.SpecFlow as a Cake Tool
#tool nuget:?package=Allure.SpecFlow&version=2.9.2-preview.1&prerelease

SpecFlow Adapter alternate text is missing from this package README image

Currently supports SpecFlow v2.1 - 3.1.*

See Allure report generated from https://github.com/allure-framework/allure-csharp/tree/main/Allure.Features

Please use corresponding NuGet package version.

Installation

Install Allure.SpecFlow nuget package according to your Specflow version.

Configuration

For Specflow 3 please add or update the following section in your specflow.json:

"stepAssemblies": [
 { "assembly": "Allure.SpecFlowPlugin" }
]

The plugin uses Allure.Commons json configuration extended with custom sections.

Custom host name

In case if you want to customize host name which is displayed in Allure Timeline section, please configure allure.title property in json configuraion file.

If you use NUnit

Default value for allure.directory in allureConfig.json is "allure-results", default working directory in NUnit 3.* is the working directory of console runner. If you don't want to place allure results into NUnit default working folder please either set absolute path in allure.config or set working directory for NUnit in your test setup, e.g.:

[OneTimeSetUp]
public void Init()
{
   Environment.CurrentDirectory = Path.GetDirectoryName(GetType().Assembly.Location);
}

Usage

Just run your SpecFlow scenarios and find allure-results folder ready to generate Allure report.

Features

Grouping

You can structure your scenarios in 3 Allure hierarchies using feature and scenario tags. Please read report structure Allure documentation section for additional details. Hierarchies consist of the following levels:

Suites

  • Parent Suite
    • Suite
      • Sub Suite

Behaviors

  • Epic
    • Feature
      • Story

Packages

  • Package
    • Class
      • Method

The plugin uses allure:grouping configuration section to parse tags with the regular expression. If the expression contains the group, it will be used as hierarchy level name otherwise entire match will be used. E.g:

^mytag.* : any tags starting with @mytag will be used for grouping.

^type:(ui|api) : @ui or @api tags from regex pattern will be used for grouping.

Check this config example as a starting point.

You can add links to your scenarios using tags. Tag and link patterns can be configured in allureConfig.json

{
  "allure": {
    "links": [
      "https://myissuetracker.org/{issue}",
      "https://mytestmanagementsystem.org?test={tms}"
    ]
  },
  "specflow": {
    "links": {
      "link": "^link:(.+)",
      "issue": "^\\d+",
      "tms": "^tms:(\\d+)"
    }
  }
}

The following scenario

@123456 @tms:42 @link:http://example.org 
Scenario: I do like click on links in Allure report 

will have three links in Allure report: 123456, 42 and http://example.org.

In case there are links, which are generated during tests, then they can be added in code via AllureLifecycle:

AllureLifecycle.UpdateTestCase(testResult.uuid, tc =>
            {
                tc.links.Add(new Link()
                {
                    name = "Example link",
                    url = "http://example.com"
                });
            });

This will show for scenario link with Text: Example link; and url: "http://example.com".

Severity

You can add Severity for your scenarios using tags. It can be configured in allureConfig.json

 "labels": {
      "severity": "^(normal|blocker|critical|minor|trivial)"
    },

The following scenario

@critical
Scenario: ....

will set current scenario severity in Allure report as Blocker

Label

You can add Label for your scenarios using tags. It can be configured in allureConfig.json

 "labels": {
      "label": "^label:([\\w]+):(.+)"
    },

The following scenario

@label:layer:e2e: @label:as_id:123
Scenario: ....

will set current scenario Layer as e2e and Id as 123 in Allure report

Tables conversion

Table arguments in SpecFlow steps can be converted either to step csv-attacments or step parameters in the Allure report. The conversion is configurable in specflow:stepArguments config section. With specflow:stepArguments:convertToParameters set to true the following table arguments will be represented as parameters:

  • one row tables
  • two column tables with the headers matching both specflow:stepArguments:paramNameRegex and specflow:stepArguments:paramValueRegex regular expressions.

<table> <th>SpecFlow</th> <th>Allure</th> <tr> <td>

alternate text is missing from this package README image

</td> <td>

alternate text is missing from this package README image

</td> </tr> </table>

Attachments

You can add attachments to an Allure report from your step bindings:

using Allure.Commons;
...
AllureLifecycle.Instance.AddAttachment(path, "Attachment Title");
// or
AllureLifecycle.Instance.AddAttachment("Attachment Title", "application/txt", "path");
// where "application/txt" - type of your attachment
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.12.0 741 4/2/2024
2.11.0 12,344 11/29/2023
2.10.0 3,433 10/16/2023
2.10.0-preview.1 433 9/22/2023
2.9.5-preview.1 5,855 3/22/2023
2.9.4-preview.6 1,046 2/13/2023
2.9.4-preview.5 97 2/13/2023
2.9.4-preview.2 191 1/2/2023
2.9.4-preview.1 113 12/30/2022
2.9.3-preview.1 108 12/23/2022
2.9.2-preview.1 1,068 9/19/2022
2.9.1-preview.7-nunit-fixtures 199 8/2/2022
2.9.1-preview.6-nunit-fixtures 126 7/27/2022
2.9.1-preview.5 136 7/27/2022
2.9.1-preview.3 145 7/12/2022
2.9.1-preview.2 148 7/12/2022