What is Model Based Testing?
Model based testing is a software testing technique where run time behavior of software under test is checked against predictions made by a model.
What is Model?
A model is a description of a system's behavior. Behavior can be described in terms of input sequences, actions, conditions, output and flow of data from input to output. It should be practically understandable and can be reusable.
There are numerous models available and it describes different aspects of the system behavior. Examples of the model are:
State transition machines
Model Based Testing Example
As shown in Diagram above, Model Based Testing typical involves 3 Stages before actual testing gets execute either Manual or through Model Based Test Automation Tools
1. Understanding Application Screens and Components Flow
In this phase you understand each application screen and define interaction between these components as per business flows
2. Recorded Test Cases Creation
In this phase based on interaction between different components of Application Screens, we generate test case flows. Every test case flow Start with Component containing first row of Model and Ends with component containing last row of Model.
3. Optimized Model
In this phase model gets optimized with minimum possible combinations, eliminate any redundant paths and add decision points while transition happens from 1 component to other component.
Types of MBT:
There are two types of Model based testing framework.
Offline MBT: Generation of Test Suites before executing it. A test suite is nothing but a collection of test cases.
Different Models in MBT Testing:
In order to understand the MBT, it is necessary to understand some of the models explained below. Let's go through one by one:
Finite State Machines:
This model helps testers to assess the result depending on the input selected. There can be various combinations of the inputs which result in a corresponding state of the system.
The system will have a specific state and current state which is governed by a set of inputs given from the testers.
It is an extension of Finite state machine and can be used for complex and real time systems. Statecharts are used to describe various behaviors of the system. It has a definite number of states. The behavior of the system is analyzed and represented in the form of events for each state.
Example Diagram below describing how to test Login Functionality with state charts.
Unified Modeling Language (UML):
Unified Modeling Language (UML) is a standardized general-purpose modeling language. UML includes a set of graphic notation techniques to create visual models of that can describe very complicated behavior of the system.
Example below describing different type of UML Diagrams.
Use Case Diagrams most common UML Diagram that can be used for testing.
Advantages of Model Based Testing:
Following are benefits of MBT:
Easy test case/suite maintenance
Reduction in Cost
Improved Test Coverage
Early defect detection
Increase in defect count
Improved tester job satisfaction
Building better QA for tomorrow