Software Testing Class

Tutorial 10 – Using Decision Table and Query table in Fitnesse

Using a Decision Table and Query table in FitNesse tutorial, we are going to discuss three SLIM testing engine table types. These are:

As discussed in the last tutorial, in order to work on the query, subset query and ordered query tables, we need to define TEST_SYSTEM as slim. This is the first requirement before we start writing fixtures and FitNesse tests using these tables.

!define TEST_SYSTEM {slim}

If the above variable is set on your current FitNesse page or on any of the parent page, then your page will be run with the slim test system and we can work on these query tables. Let’s discuss them in detail.

Query Table:

Query table supplies the expected results of a query. It is similar to the Fit Row Fixture. To work with the Query table, we need to do the following.

Fitnesse Using Decision Table and Query table

This is the query table structure; operationally FitNesse slim test system checks each row in the table to see if there is a match in the query response. The matching sequence for the fields is left to right. If the leftmost field matches, then the row is considered to be “found” and the fields that don’t match are marked in error (in red color). For example, when the department “Quality Analyst” does not match with “Developer”, it will be marked with red color.

Few Points to Remember About Query Table:

Java Fixture used for Query table demonstration:  Like any ordinary Java class, this fixture has a constructor that can accept arguments, a table method and a query method that returns the table data as rows and columns in the form of lists within in a list. E.g. list (list1, list2). This fixture is demonstrated below.

FitNesse Test Screenshot for Query table (Scenario 1):  In this scenario, one of the columns in the query table does not match with the result; it is marked with red color. Remaining all columns or cells are marked with green color.

FitNesse Test Screenshot for Query table (Scenario 2):  In this scenario of the query table, all cells in the table are matching with the result set. Therefore, the entire FitNesse test page is green all around.

Subset Query Table:

Subset query table supplies a subset of the expected results of a query. To work with Subset Query table, we need to do the following.

In the above subset query table, we used the existing query table fixture and tested the FitNesse page with fewer numbers of columns instead of all rows and column pairs as in the case of Query table.

Ordered query Table

Ordered query table supplies the expected results of a query. In this table, the rows are expected to be in order. This slim table function is similar to the Fit Row Fixture. To work with Ordered Query table, we need to do the following.

Few Points to remember about Ordered Query table:

In an ordered query table, the order of the returned rows is very important and it has a matching algorithm. The matching algorithm is relative which means that if the ordered query table rows have the following order {A, B, C, D} and the query returns {B, C, D, A} then rows B, C and D will be green, and only row A will be marked in red as it is “out of order: row 1”. This is to be noted that the row number in the error message is the ordinal position (based on 1) of that row in the query result as shown below.

Based on the above facts this is inevitable that the first row in the table can never be out of order in case of an ordered query table. Also, if we repeat any such row or add a number of rows that returned by the result that, FitNesse will be marked any such extra row as missing. Such a scenario is shown above.


⇓ 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