Model Based Testing with Logical Properties versus State Machines Pieter Koopman, Peter Achten, and Rinus Plasmeijer Institute for Computing and Information Sciences (ICIS), Radboud University Nijmegen, The Netherlands {pieter,p.achten,rinus}@cs.ru.nl Abstract. Model-based testing of single functions is usually based on logical properties as specification. In practice it appears to be rather hard to develop a sufficiently strong set of properties to spot all errors. For model-based testing of state based systems one usually employs a state machine as model and a conformance relation between this specification and the software under test. For (abstract) data types we can use both ways of model-based testing. In this paper we compare the specification effort required to make a model that is able to find issues and the num- ber of tests needed to find issues for some well-known data types. Our examples show that it can be easier to write state based specifications. Moreover, state based testing of data types finds more implementation issues and is very efficient. 1 Introduction Many polymorphic abstract data types, adts, are used to store items in one way or another. Typical examples of such a storage structure are files, search trees, lists, and queues. In a functional programming language the interface of such an adt is just a set of functions. In order to test the implementation of such an adt two different approaches can be used. First, we can state logical properties about functions in the interface, or combinations of these functions. Second, we can treat the actual contents of the adt as state in a model-based conformance test. In this paper we compare these approaches based on the effort needed to make a specification for an effective model-based test and the error detection power of the associated tests. In the world of functional programming languages the model-based testing approach based on logical properties is best known. This is mainly due to the success of QuickCheck [6]. Such a test tool is typically a library offering a domain specific language to state logical properties. Model-based test tools founded on logical properties try to falsify properties by finding a counterexample. This is done by generating test data of the desired type and evaluating the property for these values. When the property evaluates to false for one of the test values used the property is falsified, otherwise it passes the test. Another popular approach to model-based testing is based on state transition models and a conformance relation between the model and the system under A. Gill and J. Hage (Eds.): IFL 2011, LNCS 7257, pp. 116–133, 2012. c Springer-Verlag Berlin Heidelberg 2012