Modern Gherkin-based BDD framework for .NET ecosystem
- NET 8+ (.NET 9 is recommended)
- Visual Studio 2022 or Visual Studio Code or any other editor with .NET support
Optional: gherking syntax plugin for your code editor:
- Reqnroll plugin for Visual Studio 2022
- Cucumber plugin for Visual Studio Code or any other plugin
- Create new class library for .NET 8+
- Add following nuget packages:
- https://www.nuget.org/packages/NGherkin
- https://www.nuget.org/packages/NGherkin.TestAdapter
- https://www.nuget.org/packages/Microsoft.NET.Test.Sdk
- Create startup class and register dependencies. Example:
public sealed class Startup : StartupBase
{
public override void Configure(IServiceCollection services)
{
services.AddGherkinFeatures();
services.AddGherkinSteps();
}
}
- Add feature files
- Add classes with steps. Example:
[Steps]
internal sealed class StepClass
{
[Given("given1")]
public void Given()
{
}
[When("this is when step with '(.*)' argument an '(.*)' argument")]
public void When1(int arg1, string arg2, DataTable dataTable)
{
}
[Then("then1")]
public void Then1()
{
}
}