- Posted by liammclennan on November 19, 2009
I have written about about WebAii before. It is functional but the API sucks. I have written about NGourd too.
I am currently working on a project that is using the combination of NGourd and WebAiii for automated acceptance testing. We start with a story:
Feature: Search
As a user
I want to search for items
so that I can find data that I am interested in
and then write some scenarios like:
Scenario: Search for a compensation agreement
Given I am at the home page
When I select the Agreements perspective
And I search for 'agreement 1'
Then the search results should be displayed
Within the test project we have the following directory structure:

Search.feature is a text file containing the previously listed feature and scenario definitions. For each scenario step we must have a corresponding step definition. For example the step ‘When I select the Agreements perspective’ matches the following step definition:
[Step(@"search for '([\w\s]+)'")]
public void search_for(string searchTerm)
{
CurrentBrowser.Find.ById("Terms").SetValue("value", searchTerm);
CurrentBrowser.Click(CurrentBrowser.Find.ById("search_submit"));
}
Note the use of regular expressions to parameterise the step. Because this step is an action we put it in the ActionSteps file. Everything that we need to do for our tests falls into one of the three categories: Action, ContentAssertion or Navigation. The goal is to avoid defining the same step twice so that the set of steps form a domain specific language that can be used by business analysts and the like.
NGourd is a Cucumber knockoff, but without many of the features. However, it is surprising how far you can get with just the basics. So far it is working nicely.
- Posted by liammclennan on October 16, 2009
Executable specifications are the holy grail of software development. The idea is to specify the behaviour of a system in some structured way that can be automatically verified. It is something that I am interested in so I have been keeping an eye on the options that are available for .NET.
Cucumber with IronRuby
Cucumber is a popular ruby tool. Specifications are written as plain text files and made executable by writing regular expressions for each line of the text file. Cucumber has a strong BDD flavour, encouraging users to write their specifications in the given, when, then style. I have not tried it myself but I know a number of people have indicated that getting cucumber to work in ironruby is difficult.
NGourd
NGourd is a native .NET project inspired by Cucumber and written largely by Mike Minutillo. Again, regular expressions are used to extract the parameters from the specifications, but this time the regular expressions are written as attributes. I contributed some code to this project to log its the output in a format that can be used by build servers such as Team City and Cruise Control .NET. NGourd is rudimentary but it does work and I have used it in some of my projects. As a developer, this type of tool is my first choice. I like that the specifications are plain text files that can be easily processed and versioned. However, if the aim is to have non-programmers working on the specifications then I fear that plain text may not offer them enough support.
StoryTeller
StoryTeller is a tool by Jeremy Miller, inspired by FitNesse. In StoryTeller, developers define a grammer for tests and then non-developer users can build specifications using a GUI. Because the GUI assists the user with the grammer StoryTeller is probably easier to use for non-technical people.
Executable specifications are an exciting idea, and I hope that one day it will be the way that we all build software. At this moment the tooling is rapidly improving. I like the text based tools for use by developers with BDD style functional testing, and I like StoryTeller for its improved support for customer involvement.