Thursday, 7 July 2016

BDD - Cucumber and Fitnesse

As I assured you in my previous posts, I will take you to another interesting journey of open source tools which are in news for a while and increasing their share in the market.

Before we embark on this journey, I should provide you some background about it. In one of the recent project, I got the opportunity to work on Fitnesse and in a while another opportunity to work on Cucumber. This helped me to understand the difference from the testing perspective. So what is so different about these tools? 

Behaviour Driven Development (BDD)–

First of all let’s understand what BDD is? BDD is Behaviour Driven Development means write down the expected behaviour or functionality desired by the stake holders in simple English like language. The domain experts write the behaviour expected and then run the code to validate if the application is behaving as expected. Due to simple English like language or simple input output tables any domain expert can create many different test scenarios.

 These tests then developers use to write a code to make sure the application is behaving as expected. The development is driven by the behaviour of application and the business users are the directing from high-level scenarios.

The image shows that how developers keep on updating code to make sure the application behaves as domain experts expects it to behave.

Now let’s see how Cucumber and Fitnesse are fit for the purpose?

1. Cucumber uses feature files containing keywords like Feature, Scenario, When, Then. These keywords help domain experts to write scenarios in simple English.

Feature: As a reader of this post I want to read all other posts on testing tools  
Scenario: Users should see the link to all other posts on this blog
When: User is on this post
Then:  Should see the links to other posts on testing tools

Step definitions (the code) which will be created using Java or Ruby to run the mentioned scenario against the application under test.

Fitnesse uses wiki pages to create a input-output table as shown in the below example-
Links to other posts?
BDD - Cucumber and Fitnesse
BDD - Cucumber and Fitnesse
In the above example we will verify expected results with the application under test from the last column.

To run this test table we need to have some code. The code which we write for these tables is known as Fixture code. Fixture code can we be written in language like Java or C#.

Fitnesse uses Fit and Slim fixtures. More information on fixtures is available on the Fitnesse wiki.

Both Cucumber and Fitnesse have XML and HTML reporting. Cucumber uses Junit framework on other hand Fitnesse uses test runner.

We will continue our journey to see more software testing tools. Please do not forget to comment or write your feedback.

Happy Exploring!