Skip to content

TestStack/TestStack.BDDfy

Repository files navigation

Build Status NuGet

BDDfy

The simplest BDD framework for .NET — easy to use, customize, and extend.

Key Features

  • Works with any test framework — xUnit, NUnit, MSTest, or plain POCO classes
  • No special test runner — use your IDE, dotnet test, or any runner you prefer
  • Two flexible APIs — convention-based (reflective) or explicit (fluent)
  • Rich reporting — Console, HTML (Classic & Metro), Markdown, Text, and JSON diagnostics
  • Data-driven scenariosExampleTable for parameterized tests
  • Stories are optional — group scenarios under stories or run them standalone
  • Fully extensible — custom reporters, scanners, step executors, and humanizers
  • Async supportTask-returning and async void step methods

Quick Start

dotnet add package TestStack.BDDfy

Reflective API (convention-based)

Name your methods with Given/When/Then prefixes:

public class ShouldRefundItem
{
	void GivenTheItemWasBoughtRecently() { }
	void WhenTheCustomerReturnsIt() { }
	void ThenARefundIsIssued() { }

	[Fact]
	public void Execute() => this.BDDfy();
}

Fluent API (explicit)

[Fact]
public void CardHasBeenDisabled()
{
	this.Given(s => s.GivenTheCardIsDisabled())
		.When(s => s.WhenTheAccountHolderRequests(20))
		.Then(s => s.ThenTheAtmRetainsTheCard())
		.BDDfy();
}

Both produce readable reports:

Scenario: Should refund item
	Given the item was bought recently
	When the customer returns it
	Then a refund is issued

📖 Documentation

Full documentation is available in the docs/ folder:

Guide Description
Getting Started Installation and first scenario
Reflective API Method naming conventions and executable attributes
Fluent API Chainable Given/When/Then builder
Stories Story metadata, shared stories, standalone scenarios
Examples Data-driven scenarios with ExampleTable
Reporters Console, HTML, Markdown, Text, and Diagnostics reporters
Configuration Customizing the BDDfy pipeline
Extensibility Custom reporters, scanners, and step executors
Async Support Async Task and async void steps
Tags Tagging and filtering scenarios

IDE Annotations

Step-discovery attributes ([Given], [When], [Then], etc.) are marked with MeansImplicitUse so IDEs like ReSharper and Rider won't flag step methods as unused. See src/TestStack.BDDfy/Properties/Annotations.cs for details.

Authors

License

BDDfy is released under the MIT License. See the bundled license.txt file for details.

About

BDDfy is the simplest BDD framework EVER!

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages