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.
<PackageVersion Include="Xunit.Scenario" Version="1.0.8" />
                    
Directory.Packages.props
<PackageReference Include="Xunit.Scenario" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xunit.Scenario --version 1.0.8
                    
#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.
#:package Xunit.Scenario@1.0.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xunit.Scenario&version=1.0.8
                    
Install as a Cake Addin
#tool nuget:?package=Xunit.Scenario&version=1.0.8
                    
Install as a Cake Tool

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 { }
    }
}

There are no supported framework assets in this 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
1.0.8 541 11/7/2021
1.0.7 439 11/6/2021
1.0.6 405 11/6/2021
1.0.5 979 11/6/2021
1.0.4 452 11/4/2021