Project DescriptionStoryQ is a portable (single dll), embedded BDD framework for .NET 3.5. It runs within your existing test runner and helps produce human-friendly test output (html or text). StoryQ's fluent interface adds strong typing, intellisense and documentation to your BDD grammar.
Press Coverage
StoryQ was covered by David Starr from Pluralsight in his tech ed talk and the pluralsight podcast. The tech ed talk especially is great introduction to BDD!
What does StoryQ do?
Given the following plain text story:
Story is Data Safety
In order to Keep my data safe
As a User
I want All credit card numbers to be encrypted
With scenario submitting shopping cart
Given I have typed my credit card number into the checkout page
When I click the Buy button
And the browser posts my credit card number over the internet
Then the form should be posted over https
When we represent this in C# with StoryQ:
Note that we've added an optional
Tag, "sprint 1", to the story here.
using StoryQ;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace StoryQ.Demo
{
[TestClass]
public class DemoTest
{
[TestMethod]
public void PassingExample()
{
new Story("Data Safety").Tag("sprint 1")
.InOrderTo("Keep my data safe")
.AsA("User")
.IWant("All credit card numbers to be encrypted")
.WithScenario("submitting shopping cart")
.Given(IHaveTypedMyCreditCardNumberIntoTheCheckoutPage)
.When(IClickThe_Button, "Buy")
.And(TheBrowserPostsMyCreditCardNumberOverTheInternet)
.Then(TheForm_BePostedOverHttps, true)
.ExecuteWithReport(MethodBase.GetCurrentMethod());
}
note that StoryQ comes with a Converter GUI that can convert this automatically for you
Then the output of the test runner will be:
Story is Data Safety => (#sprint 1)
In order to Keep my data safe
As a User
I want All credit card numbers to be encrypted
With scenario submitting shopping cart
Given I have typed my credit card number into the checkout page => Passed
When I click the Buy button => Passed
And the browser posts my credit card number over the internet => Passed
Then the form should be posted over https => Passed
And there will be a report generated that looks like:
You can also have a simple report by changing a StoryQ setting:
[TestFixtureSetUp]
public void SetUp()
{
StoryQSettings.ReportSupportsLegacyBrowsers = true;
}
And there will be a report generated that looks like:
You can see a full example, including pending (not yet implemented) and failing tests here
Understanding StoryQ
If you are new to BDD, we recommend you start with the
BDD Primer.
Then you'll be ready to
write your first StoryQ test.
StoryQ can be
applied to existing unit testsThe fluent interface/grammar in StoryQ is generated from a simple DSL, and is fully
customizable.