Software Testing Class

BDD Style Testing using FitNesse

In this tutorial, we are going to discuss and learn about Scenario table and how such slim table can be used for BDD Style of testing.

BDD Stands for ‘Behavior Driven Development’. BDD “tests” exist at multiple different levels of granularity, all the way up to the initial project vision. Acceptance testing doesn’t actually mandate the conversations and it usually works from the assumption that these tests that we are writing are the right tests. In BDD, we assume that we don’t know what we’re doing and probably don’t know that we really don’t know. This is why we use things like “Given, When, Then, etc.”, so that we can have conversations around the scenarios and build our unit-level examples.

In FitNesse, we can achieve BDD style testing by using Scenario tables present in the slim testing engine. Below is the demonstration.

Scenario Table

BDD Style Testing using Fitnesse

Scenario tables in slim test engine can be defined as a way to express a sequence of abstract steps. Unlike the other slim table that we have seen in past chapters, scenario tables are not necessarily backed by a particular fixture. This means that, if we simply declare a sequence of steps in a scenario table, FitNesse, when run for test, will not attempt to do anything with it, therefore, we will not need a backing fixture for that. However, as soon as we define concrete tests on FitNesse page that use the scenario table, then we will be required to make sure a fixture is in place. This is to be noted that for the same Scenario table it is possible to be backed by different fixtures for different uses.

A Scenario table is a slim testing engine table that can be called from other tables such as Script Table and Decision Table.

To work with Scenario table, we need to do the following.

Below is the Interposed style of Scenario table declaration.

Below is the Parameterized style of Scenario table declaration.

Example using Scenario table:

Below is the FitNesse test script where we have declared two scenario tables in a parameterized style known as “ShowValues” (show  _  values _) and “ExecuteThisStep”  (execute _ this _ step _). We are going to call this “ExecuteThisStep” scenario table from a decision table on the same page. 

Few points to observe and remember

When we click on the save button present at the bottom of the FitNesse page, your test page will look like as shown below.

Above page has three slim tables as follows.

To begin the FitNesse page operation, click on the Test button present at the top of the page when the test execution has completed the output of the FitNesse test page with current setup is shown below. In the decision table we have given the set of values for @a1 = 1, @b1=2 and @c1=2 which are input to scenario table (“ExecuteThisStep”) where we called another scenario table (“ShowValues”) and copied these values to a1, b1 and c1 input arguments of this table which is displayed as the scenario summary as shown below.

This is how scenario table works with other tables such as decision table and script table and here we can observe one thing that there is no underlying fixture (Java Code) which is supporting the scenario tables and in fact they are acting as fixture to the decision table which is invoking them.


⇓ Subscribe Us ⇓


If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:


 

Check email in your inbox for confirmation to get latest updates Software Testing for free.


  Happy Testing!!!
 
Exit mobile version