Testing is a very important part of software development. According to the current practice, it requires a significant proportion of resources devoted to development. Many developers use some automation to run the tests, however, specifying and designing of test cases are still manual activities.
The situation can be improved by applying the model-based testing paradigm, which generates detailed test cases from the model of the software. My thesis describes the basics of testing, especially model-based software testing and modeling using the SpecExplorer tool. Microsoft SpecExplorer 2010 extends the Visual Studio’s testing capabilities with model-based test generation. With this tool the model of the system-under-test (SUT) can be written in C# language, and the Cord script language can be used to describe how to explore this model, and what test cases should be generated.
During my work I developed a class library and a graphical user interface to demonstrate test generation and testing them with SpecExplorer. I defined the functions to be tested, then prepared the model of the implementation, and defined the set of parameters for each rule.
I also used parameters that are unlikely to occur in normal use, so I tried to make sure that the program works correctly under all circumstances. Finally, I made slices along the models. I organized slices into test cases, and then generated the test code.
With the current version of SpecExplorer long and short test cases can be generated. In both cases I executed the tests, and observed that the same number of tests failed. I corrected the bugs based on the long test cases, and then ran tests in both modes to check that each test is passed successfully.
Finally, I looked at how to generate a test that checks the coverage of the system requirements. I looked at how coverage changes if a new requirement is put in the model.
Overall, model-based testing and automatic test generation may reduce the time required for testing. Of course, in case of a simple program, the improvement is hardly noticeable, but in case of a large system, surely.