Citation
Casso, Ignacio de and Morales Caballero, José Francisco and López García, Pedro and Hermenegildo, Manuel V.
(2019).
An integrated approach to assertion-based random testing in Prolog.
In: "29th International Symposium on Logic-Based Program Synthesis and Transformation ( LOPSTR 2019)", 8-10 Oct 2019, Oporto, Portugal. ISBN 978-3-030-45259-9. pp. 159-176.
https://doi.org/10.1007/978-3-030-45260-5_10.
Abstract
We present an approach for assertion-based random testing of Prolog programs that is tightly integrated within an overall assertionbased program development scheme. Our starting point is the Ciao model, a framework that unifies unit testing and run-time verification, as well as static verification and static debugging, using a common assertion language. Properties which cannot be verified statically are checked dynamically. In this context, the idea of generating random test values from assertion preconditions emerges naturally since these preconditions are conjunctions of literals, and the corresponding predicates can in principle be used as generators. Our tool generates valid inputs from the properties that appear in the assertions shared with other parts of the model, and the run time-check instrumentation of the Ciao framework is used to perform a wide variety of checks. This integration also facilitates the combination with static analysis. The generation process is based on running standard predicates under non-standard (random) search rules. Generation can be fully automatic but can also be guided or defined specifically by the user. We propose methods for supporting (C)LP-specific properties, including combinations of shape-based (regular) types and variable sharing and instantiation, and we also provide some ideas for shrinking for these properties. We also provide a case study applying the tool to the verification and checking of the code of some of the abstract domains used by the Ciao system.