Allure.SpecFlow
2.11.0
See the version list below for details.
dotnet add package Allure.SpecFlow --version 2.11.0
NuGet\Install-Package Allure.SpecFlow -Version 2.11.0
<PackageReference Include="Allure.SpecFlow" Version="2.11.0" />
paket add Allure.SpecFlow --version 2.11.0
#r "nuget: Allure.SpecFlow, 2.11.0"
// Install Allure.SpecFlow as a Cake Addin
#addin nuget:?package=Allure.SpecFlow&version=2.11.0
// Install Allure.SpecFlow as a Cake Tool
#tool nuget:?package=Allure.SpecFlow&version=2.11.0
SpecFlow Adapter ![alternate text is missing from this package README image](https://img.shields.io/nuget/vpre/Allure.SpecFlow.svg?style=flat)
Currently supports SpecFlow v2.1 - 3.9.*
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.
For users of Mac with Apple silicon
If you're developing on a Mac machine with Apple silicon, make sure you have Rosetta installed. Follow this article for the instructions: https://support.apple.com/en-us/HT211861
You may also install Rosetta via the CLI:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Configuration
For Specflow 3 please add or update the following section in your specflow.json:
{
"stepAssemblies": [
{ "assembly": "Allure.SpecFlowPlugin" }
]
}
The plugin uses allureConfig.json extended with custom sections that are described below.
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.
{
"allure": {
"title": "My title"
}
}
If you use NUnit
The default value for allure.directory in allureConfig.json is "allure-results". The default working directory in NUnit 3.* depends on what runner you use.
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 the 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.
Links
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.
Links generated dynamically during the tests can be added in code via AllureLifecycle. The next example adds the Example link link at runtime:
AllureLifecycle.Instance.UpdateTestCase(tc =>
{
tc.links.Add(new Link()
{
name = "Example link",
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: ....
sets the current scenario's severity in Allure report as Blocker.
Label
You can add allure labels for your scenarios using tags. It can be configured
in allureConfig.json
:
"labels": {
"label": "^label:([\\w]+):(.+)"
},
The following scenario
@label:layer:e2e: @label:allure_id:123
Scenario: ....
sets the current scenario's 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
andspecflow:stepArguments:paramValueRegex
regular expressions.
<table> <th>SpecFlow</th> <th>Allure</th> <tr> <td>
</td> <td>
</td> </tr> </table>
Attachments
You can add attachments to an Allure report from your step bindings:
using Allure.Net.Commons;
...
Allure.AddAttachment(path, "Attachment Title");
// or
Allure.AddAttachment("Attachment Title", "application/txt", "path");
// where "application/txt" - the type of your attachment
Known issues
Selective run might not work
Under rare circumstances selective run feature might not work. Issue [#369] contains some additional details.
If you are affected by this, you may try to switch to the Debug
configuration
as a workaround until we come up with a solution.
Product | Versions 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 was computed. 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. |
-
.NETStandard 2.0
- Allure.Net.Commons (>= 2.11.0)
- CsvHelper (>= 30.0.1)
- Lib.Harmony (>= 2.3.0-prerelease.2)
- SpecFlow (>= 3.9.8 && < 3.10.0)
- System.Collections.Specialized (>= 4.3.0)
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 | 1,561 | 4/2/2024 |
2.11.0 | 15,380 | 11/29/2023 |
2.10.0 | 3,598 | 10/16/2023 |
2.10.0-preview.1 | 508 | 9/22/2023 |
2.9.5-preview.1 | 5,944 | 3/22/2023 |
2.9.4-preview.6 | 1,052 | 2/13/2023 |
2.9.4-preview.5 | 97 | 2/13/2023 |
2.9.4-preview.2 | 193 | 1/2/2023 |
2.9.4-preview.1 | 114 | 12/30/2022 |
2.9.3-preview.1 | 108 | 12/23/2022 |
2.9.2-preview.1 | 1,069 | 9/19/2022 |
2.9.1-preview.7-nunit-fixtures | 200 | 8/2/2022 |
2.9.1-preview.6-nunit-fixtures | 127 | 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 |