Model based testing
Does anyone here use model based testing in their applications regularly? If yes, what are the tools you use and in what scenarios do you normally resort to model based testing?
I am specifically looking for replies from testers outside MSFT, please.
Anutthara,
After reading Harry Robinson's Model-Based Testing paper (http://www.geocities.com/harry_robinson_testing/graph_theory.htm) I was inspired to write a little vbscript using Mercury QuickTest Pro to "Monkey Test" notepad. This was a proof of concept type thing I did in some spare time. However, I plan to use it for my current AUT if I can scrape up the time. In practice, it will probably take away more testing time than it will actually find any valuable bugs but it sure seems fun!
Here is what I did:
1.) To write the test, I first started with an Excel spreadsheet with columns for "Start State", "Action", and "End State". Start State and End State columns contained lists of several states I selected from notepad such as "Notepad is closed", Notepad is opened", "Notepad contains text", "Notepad does not contain text", "Bold text exists", "Bold text does not exist". The Action column contained an action that could be performed on that row's Start State that would result in that row's End State such as the following:
Notepad is closed........open Notepad.........Notepad is opened
Notepad does not contain text........enter random text.........Notepad contains text
Notepad does not contain text........close Notepad.........Notepad is closed
Notepad contains unsaved changes........save changes.........Notepad contains saved changes
2.) Write a function for each action
3.) Write a script that begins by looking for one of your Start States by randomly selecting any row from your spreadsheet that has that Start State. After selecting the row, perform the action, collect that row's End State, then randomly select any row from your spreadsheet that has a Start State equal to the End State you just collected. Make sense?
4.) You can execute this test two ways. One is to define a start and end state for your test. For example, you could tell your script when a specific End State is reached, end the test. Or you could let the test run for a given time period.
5.) A final part I added was an output file that logged each action/state performed. If your test is lucky enough to find a bug, you'll need this for the repro steps. You can even read that log back into a modified version of your script for an automated repro test.
The fun part about this is you can get up and running with a simple test that only consumes a few rows. As you write more Action functions for your AUT, you can simply add rows to the spreadsheet and your "Monkey Tests" become more complex.