Automatic Test Generation From Statecharts Using Model Checking

This paper describes a method for automatic generation of tests from specifications written in Statecharts. These tests are to be applied to an implementation to validate the consistency of the implementation with respect to the specification. For test coverage, we adapt the notions of control-flow coverage and data-flow coverage used traditionally in software testing to Statecharts. In particular, we redefine these notions for Statecharts and formulate test generation problem as finding a counterexample during the model checking of a Statecharts specification. The ability to generate a counterexample allows test generation to be automatic. To illustrate our approach, we show how to translate Statecharts to SMV, after defining the semantics of Statecharts using Kripke structures. We, then, describe how to formulate various test coverage criteria in CTL, and show how the SMV model checker can be used to generate only executable tests.