Xunit.Scenario
1.0.8
dotnet add package Xunit.Scenario --version 1.0.8
NuGet\Install-Package Xunit.Scenario -Version 1.0.8
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.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Xunit.Scenario --version 1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Xunit.Scenario, 1.0.8"
#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.8 // Install Xunit.Scenario as a Cake Tool #tool nuget:?package=Xunit.Scenario&version=1.0.8
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?
- It automatically generates readable tests based on scenario text.
- Simplifies the creation of UI/API Automation Acceptance Tests.
- 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;
[assembly: TestFramework("Xunit.Scenario.Extension.XunitScenarioTestFramework", "Xunit.Scenario.Extension")]
- 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.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.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.