Xunit.Scenario
1.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Xunit.Scenario --version 1.0.6
NuGet\Install-Package Xunit.Scenario -Version 1.0.6
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="Xunit.Scenario" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Xunit.Scenario --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Xunit.Scenario, 1.0.6"
#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 Xunit.Scenario as a Cake Addin #addin nuget:?package=Xunit.Scenario&version=1.0.6 // Install Xunit.Scenario as a Cake Tool #tool nuget:?package=Xunit.Scenario&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Xunit scenario code generator extension
This is a Xunit framework extension. It provides implementations that make it possible to run scenario using Xunit tests.
- It runs tests in order.
- It shares context between tests.
- It fails not run tests if one test fails in the test class.
Why Use This Library?
- Spec flow is a good library but it is not free when to use with Azure DevOps.
- It automatically generates readable test cases based on scenario text.
- It is an additional extension for Xunit, so it is possible to create scenario tests and regular Xunit tests.
Getting started
- Create a new Xunit test project
- Install the Xunit.Scenario nuget package
- Create the Setup class.
- Add assembly attribute with XunitScenarioTestFramework setup to it
using Xunit.Scenario;
using Xunit;
[assembly: TestFramework($"Xunit.Scenario.{nameof(XunitScenarioTestFramework)}", "Xunit.Scenario")]
- Create a new test class and add a scenario attribute with description, test cases will be generated as partial methods
- Implement partial methods.
using Xunit.Scenario;
using Xunit.Scenario.Extension;
using System.Threading.Tasks;
namespace ScenarioAutoGeneration
{
[Scenario(@"
* send first request
* send second request
* send third request
* send fourth request
")]
public partial class RequestFlowAutoGeneratedScenario : ScenarioSteps<RequestFlowAutoGeneratedScenario.State>
{
public RequestFlowAutoGeneratedScenario(State state) : base(state)
{
}
public partial Task S1_send_first_request()
{
return Task.CompletedTask;
}
public partial Task S2_send_second_request() { return Task.CompletedTask; }
public partial Task S3_send_third_request() { return Task.CompletedTask; }
public partial Task S4_send_fourth_request() { return Task.CompletedTask; }
public class State { }
}
}
- View samples
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Xunit.Scenario.Extension (>= 1.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.