Behavior-Driven Development (BDD) is an Agile approach that mixes requirement gathering, documentation and acceptance testing. You write human-readable sentences describing the features of your application and how they should work. Then you implement this behavior using a tool that produces automated acceptance tests to verify that the feature is implemented correctly. Open source .NET BDD tools like SpecFlow are used to store the requirements as live documentation and to perform functional or acceptance tests.
This article presents a list of open source software testing tools to perform Behavior-Driven Development (BDD) for the .NET platform and the C# language. For each tool you will get a small description of its features. Feel free to suggest any additional .NET BDD framework or resource that you think should be included in this article. The tools, listed here are BDDfy, Concordion.NET, LightBDD, Machine.Specifications (Mspec), Nbehave, Nspec, SpecFlow, SpecsFor, Storyteller, TickSpec, xBehave.net
BDDfy is a simple open source .NET BDD framework that is easy use, customize and extend. It can run with any testing framework and you can just apply it on your POCO (test) classes. BDDfy doesn’t need a separate test runner. You can use your runner of choice. For example, you can write your BDDfy tests using NUnit and run them using NUnit console. BDDfy is very extensible: the core barely has any logic in it and delegates all its responsibilities to the extensions all of which are configurable.
Concordion.NET is a small open source Behavior Driven Development (BDD) framework for C# and .NET that lets you turn plain English descriptions of requirements into automated tests. A Concordion.NET executable specification consists of two parts: a well-formed XHTML document describing the expected behavior, and fixture code written in C# (a special Concordion.NET extension of a NUnit tests) that finds concrete examples in the document and uses them to verify the system under test. The Concordion.NET framework focuses on business readable inputs, so that the specifications are readable and can be used for system documentation.
Web site: http://www.concordion.org/dotnet/
LightBDD is an open source Behavior-Driven Development test framework that provides the ability to write tests that are easy to read, easy to track during execution and summarize the test results in user friendly report, while allowing developers to use all of the standard development tools to maintain them. LightBDD provides native support for refactoring, code analysis and test running. It has easy to read scenario definitions and scenario steps execution tracking and time measurement, usable during longer test execution. LightBDD provides support for parameterized steps with smart rules of inserting argument values to formatted step name. It also supports contextual scenario execution where steps shares dedicated context. Results reports can be produced in XML, HTML or Plain text format. It integrates with NUnit, xUnit and MsTest.TestFramework frameworks and provides cross-platform support (.NET Framework / .NET Standard / .NET Core / UWP).
Web site: https://github.com/LightBDD/LightBDD
MSpec / Machine.Specifications
MSpec or Machine.Specifications is a Context/Specification framework geared towards removing language noise and simplifying tests. MSpec is called a “context/specification” test framework because of the “grammar” that is used in describing and coding the tests or “specs”. To support readability and remove as much “noise” as possible, MSpec eschews the traditional attribute-on-method model of test construction. It instead uses custom .NET delegates.
NBehave is an open source framework for Behaviour-Driven Development (BDD) in ,NET. It was inspired by JBehave and runs on top of a ‘conventional’ Unit Testing framework like Nunit, mbunit, xunit and mstest.
Web site: https://github.com/nbehave/NBehave
NSpec is an open source testing framework for C# inspired by Mocha and RSpec. In NSpec, there is no need for access modifiers on tests, and no need to decorate test methods with attributes. It has some simple assertions, but you should really just use FluentAssertions, or Shouldly, or another assertion framework. You can build your own assertions by using extension methods. NSpec, as a member of the xSpec family, does not make use of attributes and instead obtains the same result with a set of expectations automatically created through code.
Web site: http://nspec.org/
SpecFlow is an open source .NET software testing tool that is part of the Cucumber family. It uses the official Gherkin parser and supports the .NET framework, Xamarin and Mono. You can use SpecFlow to define, manage and automatically execute human-readable acceptance tests in .NET projects. Writing easily understandable tests is a cornerstone of the BDD paradigm and also helps build up a living documentation of your system. SpecFlow integrates with Visual Studio, but can be also used from the command line (e.g. on a build server). SpecFlow supports popular testing frameworks: MSTest, NUnit, xUnit 2 and MbUnit.
Web site: http://specflow.org/
SpecsFor is a lightweight open source Behavior-Driven Development testing framework for .NET that focuses on ease of use for developers by minimizing testing friction. It includes a base test fixture that automatically handles common testing concerns, packages to address common testing needs (such as mocking and fluent asserts), and helpers to easily overcome many testing hurdles. SpecsFor is flexible enough to support most approaches to testing. From “old-school” test methods to full-blown BDD-style specifications, SpecsFor helps you write tests the way you want to write them.
Web site: http://specsfor.com/
Storyteller is an open source software testing tool to create robust, human readable acceptance tests for .NET or CoreCLR applications and a means to create “living” technical documentation. You can use Storyteller to create detailed executable specifications. Storyteller helps you create and easily maintain “living documentation” that can keep up with the pace of your development. No more excuses for missing documentation.
Web site: http://storyteller.github.io/
TickSpec is a lightweight open source Behaviour-Driven Development (BDD) framework for .NET. You can describe behaviour in plain text using the Gherkin business language, i.e. Given, When, Then. With TickSpec you can easily execute the behavior against matching F# ‘ticked’ methods, or attribute-tagged C# or F# methods. You will run your tests using normal open source unit testing tools (xUnit, NUnit or standalone), set breakpoints in the scenarios and go.
Web site: https://github.com/fsprojects/TickSpec
xBehave.net is xUnit.net extension for describing your .NET tests using natural language. Ideally suited to a variety of testing styles (e.g. BDD, TDD, ATDD, etc.), xBehave.net can be used for acceptance tests, integration tests, unit tests or any other ad-hoc testing scenarios. You can mix and match standard xUnit.net tests and xBehave.net scenarios in the same assembly or even in the same class. Use xBehave.net unobtrusively alongside other frameworks (e.g. NUnit, MSpec, etc.) in the same solution.
Web site: http://xbehave.github.io/