froglogic / All / Behavior-Driven Testing with Squish

Behavior-Driven Testing with Squish

Some agile development teams go for Behavior-Driven Testing (BDT) and its companion Behavior-Driven Development (BDD). The tests will be derived directly from user stories defined ahead of time. The idea is to include everyone with an interest in the product right from the start – be it a technical or non-technical person.

Using Squish for behavior-driven testing is as easy as the classical approach. As a candidate for inclusion in the next Squish release we implemented a JavaScript framework that consumes a Gherkin file for generation of a test skeleton, test execution and reporting.

The features that the product should fulfill are described in a semi-formal language. Martin Fowler, the person who coined the term BDD, mandated that such a domain-specific language should be business-readable. The most popular one is likely Gherkin which became popular through frameworks like Cucumber, JBehave and Behat, and is also available in Squish.

Here is how such a feature description can look like:

Feature: Filling of addressbook

Scenario: Initial state
Given no prior addressbook
When I create a new addressbook
Then no entries should be present

Scenario: State after adding first entry
Given a newly created addressbok
When entering the first person
Then one entry should be present

The test script that can automatically be generated from this input then needs to have the Given, Where and Then clauses filled with “life”. Below excerpt shows the result until the first Given condition:

var feature = new Feature("addressbook.feature");

var scenario1 = feature.addScenario("Initial state");

scenario1.Given("no prior addressbook", function () {
    this.scenario.application = new Application();

How to use in Squish

Leave a Reply

Your email address will not be published. Required fields are marked *

Copy link
Powered by Social Snap