Geeks With Blogs
Liam McLennan hackingon.net

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:

directory

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(@"select the ([\w\s]+) perspective")]
        public void select_perspective(string perspective)
        {
            CurrentBrowser.Click(CurrentBrowser.Find.PerspectiveButton(perspective));
        }

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 on Wednesday, November 18, 2009 3:51 PM | Back to top

Copyright © Liam McLennan | Powered by: GeeksWithBlogs.net