The simplest BDD framework for .NET — easy to use, customize, and extend.
- 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 scenarios —
ExampleTablefor parameterized tests - Stories are optional — group scenarios under stories or run them standalone
- Fully extensible — custom reporters, scanners, step executors, and humanizers
- Async support —
Task-returning andasync voidstep methods
dotnet add package TestStack.BDDfyName your methods with Given/When/Then prefixes:
publicclassShouldRefundItem{voidGivenTheItemWasBoughtRecently(){}voidWhenTheCustomerReturnsIt(){}voidThenARefundIsIssued(){}[Fact]publicvoidExecute()=>this.BDDfy();}[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
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 |
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.
BDDfy is released under the MIT License. See the bundled license.txt file for details.