Extracting QuickCheck specifications from EUnit test cases

Thomas Arts, Pablo Lamela Seijas, Simon Thompson
2011 Proceedings of the 10th ACM SIGPLAN workshop on Erlang - Erlang '11  
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 paper we report on mechanisms to extract QuickCheck specifications from EUnit test suites. We use the QSM algorithm to infer state machines from sets of positive and negative
more » ... races 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.
doi:10.1145/2034654.2034666 dblp:conf/erlang/ArtsST11 fatcat:m72tntvpibgwfeds757j27rd7e