Allure.SpecFlow
2.9.4-preview.1
See the version list below for details.
dotnet add package Allure.SpecFlow --version 2.9.4-preview.1
NuGet\Install-Package Allure.SpecFlow -Version 2.9.4-preview.1
<PackageReference Include="Allure.SpecFlow" Version="2.9.4-preview.1" />
paket add Allure.SpecFlow --version 2.9.4-preview.1
#r "nuget: Allure.SpecFlow, 2.9.4-preview.1"
// Install Allure.SpecFlow as a Cake Addin #addin nuget:?package=Allure.SpecFlow&version=2.9.4-preview.1&prerelease // Install Allure.SpecFlow as a Cake Tool #tool nuget:?package=Allure.SpecFlow&version=2.9.4-preview.1&prerelease
SpecFlow Adapter
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.
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.
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
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.Commons;
...
AllureLifecycle.Instance.AddAttachment(path, "Attachment Title");
// or
AllureLifecycle.Instance.AddAttachment("Attachment Title", "application/txt", "path");
// where "application/txt" - type of your attachment
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 is compatible. 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. |
-
.NETFramework 4.6.2
- Allure.Net.Commons (>= 2.9.4-preview.1)
- CsvHelper (>= 30.0.1)
- SpecFlow (>= 3.9.8 && < 3.10.0)
- System.Collections.Specialized (>= 4.3.0)
-
.NETStandard 2.0
- Allure.Net.Commons (>= 2.9.4-preview.1)
- CsvHelper (>= 30.0.1)
- 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.1 | 29,794 | 6/4/2024 |
2.12.0 | 12,436 | 4/2/2024 |
2.11.0 | 37,402 | 11/29/2023 |
2.10.0 | 4,400 | 10/16/2023 |
2.10.0-preview.1 | 883 | 9/22/2023 |
2.9.5-preview.1 | 6,437 | 3/22/2023 |
2.9.4-preview.6 | 1,131 | 2/13/2023 |
2.9.4-preview.5 | 113 | 2/13/2023 |
2.9.4-preview.2 | 208 | 1/2/2023 |
2.9.4-preview.1 | 128 | 12/30/2022 |
2.9.3-preview.1 | 124 | 12/23/2022 |
2.9.2-preview.1 | 1,101 | 9/19/2022 |
2.9.1-preview.7-nunit-fixtures | 216 | 8/2/2022 |
2.9.1-preview.6-nunit-fixtures | 146 | 7/27/2022 |
2.9.1-preview.5 | 156 | 7/27/2022 |
2.9.1-preview.3 | 160 | 7/12/2022 |
2.9.1-preview.2 | 163 | 7/12/2022 |