You can download StoryQ from CodePlex: http://storyq.codeplex.com/
StoryQ allows developers to write runnable system requirements in the Gerkin language format (Given, When, Then).
It comes with a nice little tool that converts GWT text into C# code for StoryQ using a fluent interface.
We can then turn up the code generator to produce stubs for our test class.
PLEASE NOTE: When you cut and paste this code you must add your own namespace, otherwise you will get errors later on using StoryQ)
When I paste this code into a C# class and run the test, MSTest reports these steps as pending, due to NotYetImplemented errors:
Here’s the updated code with:
- Implementations added
- A bit of refactoring
- An additional scenario added
- Execute changed to ExecuteWithReport (see below for HTML report)
We can see the initial scenario passed and the invalid credentials failed. This is because I haven’t coded up the validation of the username and password within the service yet. And the development cycle continues…
HTML Report Output
As we used the ExecuteWithReport() method we can also take a look in the bin folder and see a StoryQ_Report folder:
Within that report you can find a XML file which you can open in Internet Explorer.
Source code can be found here:
http://stevenhollidge.com/blog-source-code/BDD-REST-Demo.zip
This comment has been removed by the author.
ReplyDelete