Skip to content

Repository files navigation

Build StatusNuGet

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:

publicclassShouldRefundItem{voidGivenTheItemWasBoughtRecently(){}voidWhenTheCustomerReturnsIt(){}voidThenARefundIsIssued(){}[Fact]publicvoidExecute()=>this.BDDfy();}

Fluent API (explicit)

[Fact]publicvoidCardHasBeenDisabled(){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:

GuideDescription
Getting StartedInstallation and first scenario
Reflective APIMethod naming conventions and executable attributes
Fluent APIChainable Given/When/Then builder
StoriesStory metadata, shared stories, standalone scenarios
ExamplesData-driven scenarios with ExampleTable
ReportersConsole, HTML, Markdown, Text, and Diagnostics reporters
ConfigurationCustomizing the BDDfy pipeline
ExtensibilityCustom reporters, scanners, and step executors
Async SupportAsync Task and async void steps
TagsTagging 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

Stars

434 stars

Watchers

33 watching

Forks

Releases

Packages

Used by

Contributors

Languages