Writing EUnit tests is more common than writing QuickCheck specifications, although QuickCheck specifications potentially explore far more scenarios than manually written unit tests. In particular for implementations that have side-effects, writing a good set of EUnit tests is often difficult and labour intensive.
In this tutorial we explain a mechanism to extract QuickCheck specifications from EUnit test suites. We use the QSM algorithm to infer state machines from sets of positive and negative traces derived from the test suite. These traces can be derived either statically or dynamically and we describe both approaches here. Finally we show how to move from the inferred state machine to a QuickCheck state machine. This QuickCheck state machine can then be used to generate tests, which include the EUnit tests, but also include many new and different combinations that can augment the test suite. In this way, one can achieve substantially better testing with little extra work.
We’ll show the method in action with a test-driven development example, and encourage you to try the method out too. Please bring your own EUnit test suit to play with and see the results.
Thomas ArtsProfessor and co-founder of QuviQ AB
Prof Thomas Arts is the co-founder and CTO of Quviq, a small company that produced QuickCheck, as testing tool for Erlang. Thomas has over 30 publications in various journals and has experience refereeing conferences and workshops. He has successfully introduced some new technologies to the industry, the latest being QuickCheck, a tool for property based testing and aims to support test driven development. Thomas is also a professor at Chalmers University of Technology in Gothenburg, Sweden.
Thomas was one of the members of Ericsson's computer science lab where he worked on program verification and the development of the Erlang programming language. He has also worked in the broad spectrum theoretical computer science, formal methods and industrial case-study research, mainly applying all kind of techniques to systems written in Erlang.
Simon ThompsonCreator of Wrangler and co-author of Erlang Programming
The University of Kent
Simon Thompson is Professor of Logic and Computation in the Computing Laboratory of the University of Kent, where he has taught computing at undergraduate and postgraduate levels for the past twenty five years, where he was department head 2002-2009.
His research work has centered on functional programming: program verification, type systems, and most recently development of software tools for functional programming languages. His team has built the HaRe tool for refactoring Haskell programs, and is currently developing Wrangler to do the same for Erlang. His research has been funded by various agencies including EPSRC and the European Framework programme. His training is as a mathematician: he has an MA in Mathematics from Cambridge and a D.Phil. in mathematical logic from Oxford.
He has written four books in his field of interest; Type Theory and Functional Programming published in 1991; Miranda: The Craft of Functional Programming (1995), Haskell: The Craft of Functional Programming (3rd ed. 2011) and Erlang Programming (with Francesco Cesarini, 2009). Apart from the last, which is published by O'Reilly, these are all published by Addison Wesley.