Skip to Main Content
In this paper we present an approach for automatically deriving test input data from Design by Contract specifications. Preconditions of a method under test (MUT) require specific object states of the input parameters. In this paper we present IntiSa, a novel approach, which calculates test input values to be used with mock objects. The calculated values do not only satisfy the precondition of the method under test, but are guaranteed to be states that could be reached through method calls on the object as well. This property is not supported by previous work, such as random or pure SMT based approaches, and genetic algorithm. But it is important since it reduces false positive test cases. Based on the idea of bounded-model checking, IntiSa encodes possible state space changes of method calls for all parameters of the MUT. This model is then verified against an adopted precondition of the MUT. Besides a detailed discussion of the IntiSa approach we present results obtained by applying our technique to two case studies, one of them a real world application provided by our industry partner. First results show, that IntiSa is twice as fast as random ingenerating primitive and non-primitive test input that satisfies the precondition of the method under test.