Model Based Testing – An Introduction

Model Based Testing – An Introduction

Rate This
  • Comments 27

In this article I will attempt to give a brief overview of Model Based Testing (MBT) and provide links to help you dig in for more details. I have been increasingly getting more and more fascinated (obsessed?) with this paradigm, which I believe holds great promise for the future of the software testing discipline. Hope to rub some of that passion for MBT on to you.


MBT is an approach in which you define the behavior of a system in terms of actions that change the state of the system. Such a model of the system results in a well-defined Finite State Machine (FSM) which helps us to understand and predict the system’s behavior. For e.g. when working with a model of a car, the action of “press accelerator” has a different result depending on whether the state of the car is “neutral” or “drive”.


The biggest MBT take-away from a testing perspective is that any test case that you define is really just a traversal of the model that you have of the system – either an explicitly defined one or the one in your head. Generating test cases thus boils down to traversing this state machine. MBT is therefore especially useful for automatic generation of test sequences from the defined model. Various graph theory algorithms can be employed to walk this graph (e.g. shortest path, N-states, all-states, all-transitions etc.). The best part is that when you are using a good MBT tool, you do not need to know or dig into all this graph theory all the time. Simply define the states, actions, transitions etc. for your model and click a button to start generating tons of interesting test cases.


Model based testing offers a lot of benefits, some of which I list here. I shall expound on some of these in later posts.

1.      Forces detailed understanding of the system behavior

2.      Early bug detection (which is much cheaper)

3.      Test suite grows with the product

4.      Manage the model instead of the cases (useful when features changing constantly).

5.      Can generate endless tests (since test cases are machine generated)

6.      Resistant to pesticide paradox

7.      Find crashing and non-crashing bugs

8.      Automation is cheaper and more effective

9.      One implementation per model, then all cases free (test code is better enabled for changes).

10.  Gain automated exploratory testing

11.  Testers can address bigger test issues


Any other benefits that you think it brings to the table? I would love to hear from anyone actually using model based testing outside of Microsoft, and what their experience has been using MBT.


If I had to recommend just one and only one short introduction to Model Based Testing in order to sell the idea and get you hooked to it, I would point to this paper, Intelligent Test Automation, by Harry Robinson, which appeared a few years ago in the STQE magazine (which I believe has morphed into the Better Software magazine). Interestingly on this page, Harry has put up the 2-file state model of the example in the paper and also a Chinese Postman traversal for the model.


Here is an extensive list of technical papers related to model based testing that can help you dig into the details and the theory behind this super powerful testing paradigm.


One great publicly available tool you can use for Model Based Testing is Abstract State Machine Language(ASML) produced by the Foundations of Software Engineering(FSE) group Microsoft Research(MSR). You can actually have executable specifications with ASML, so when your Program Manager generates the functional specs, you can simply execute that spec and generate test cases directly from the spec. Buckle up - The future is here (almost)!
Leave a Comment
  • Please add 5 and 8 and type the answer here:
  • Post
  • Outstanding. I am also in love with these ideas, and even have a few to contribute. You are one of my newest favorite people. Subscribed! -JB.
  • Moreover, with .Net reflection, you can easily explore an application and build the model "on the heap"...
  • I am in love with this concept since 2001.

    Would like to share thoughts with this interest group.
  • Its great! my research area is MBT.It is quite interesting
  • My research topic model based testing and I will delighted to get more information about it

  • In a past post I talked about the basic functionality of a test harness.  That is, it should be...
  • Nihit,

    Good article for giving a insight into the exciting area of MBT
  • The future was here – now it’s the past. I am, however, wiser about the ways-of-the-model-based world....
  • In this article I will be attempting to explain one of the biggest (or what I feel is the biggest) drawback...
  • You know your team members are really catching onto this whole model-based way of thinking when they

Page 1 of 2 (27 items) 12