Model Based Testing

Introduction

This is a continuation of the previous article about three layers of BDD.

There are at least three layers of BDD:

  • Keyword Driven BDD
  • Process Driven BDD
  • Model Based Testing

Before BDD

Linear scripting is about hard coding each operational test step in a test case. Tools for capture and replay of user actions, is just to visually hard code the test cases.

Structured scripting is about reusing the most used operational test steps, by putting them in support libraries. 300 test will be updated with a single update in a support library, instead of reapplying the same change 300 times manually.

Data-driven automation runs the same test case multiple times, but with different parameters. It is very cheap to maintain.

Model Based Testing

The “Given When Then” keywords are linear and can be expanded by making them data-driven:

Given I am buying a ticket on the web shop
When buying a <ticketType> ticket
And to travel <zones> zones
And <action> special offer
Then the price should be <expectedPrice>

Where the parameters are:
ticketType | zones | action || expectedPrice
"child" | 2 | "no" || 10
"child" | 8 | "no" || 40
"adult" | 2 | "reject" || 20
"adult" | 8 | "reject" || 80
"adult" | 2 | "accept" || 15
"adult" | 8 | "accept" || 75
...

Writing the whole table will make it very large and unreadable. Adding just a single a parameter with possible values will double the size of the whole table even more.

already become very large, with

The number of parameters will grow the table so muchThe pattern can be seen with three combinations of parameters, but the pattern is unseenable with four or more paramters:

a | b | c
0 | 0 | 0
0 | 0 | 1
0 | 1 | 0
0 | 1 | 1
1 | 0 | 0
1 | 0 | 1
1 | 1 | 0
1 | 1 | 1

a is four 0
b is
Given I am buying a ticket on the web shop
When buying a <ticketType> ticket
And to travel <zones> zones
And <action> special offer
Then the price should be <expectedPrice>

Where the parameters are:
ticketType | zones | action || expectedPrice
"child" | 2 | "no" || 10
"child" | 8 | "no" || 40
"adult" | 2 | "reject" || 20
"adult" | 8 | "reject" || 80
"adult" | 2 | "accept" || 15
"adult" | 8 | "accept" || 75
...

it becomes and more it becomes (and 1 exp, but after 4 parameters

A visual model can have more than two dimensions and hide the complexity even more:

For example a IT-architect can make a flow chart of a process, which can be transformed into multiple test cases with the Process-Cycle-Test algorithm. Whenever the flow-chart is updated, the test cases will automatically changed based on this flow-chart.

Add a Comment

Your email address will not be published.