Test-case reduction via test-case generation: Insights from the hypothesis reducer
File(s)LIPIcs-ECOOP-2020-13.pdf (987.64 KB)
Published version
Author(s)
MacIver, DR
Donaldson, AF
Type
Conference Paper
Abstract
We describe internal test-case reduction, the method of test-case reduction employed by Hypothesis, a widely-used property-based testing library for Python. The key idea of internal test-case reduction is that instead of applying test-case reduction externally to generated test cases, we apply it internally, to the sequence of random choices made during generation, so that a test case is reduced by continually re-generating smaller and simpler test cases that continue to trigger some property of interest (e.g. a bug in the system under test). This allows for fully generic test-case reduction without any user intervention and without the need to write a specific test-case reducer for a particular application domain. It also significantly mitigates the impact of the test-case validity problem, by ensuring that any reduced test case is one that could in principle have been generated. We describe the rationale behind this approach, explain its implementation in Hypothesis, and present an extensive evaluation comparing its effectiveness with that of several other test-case reducers, including C-Reduce and delta debugging, on applications including Python auto-formatting, C compilers, and the SymPy symbolic math library. Our hope is that these insights into the reduction mechanism employed by Hypothesis will be useful to researchers interested in randomized testing and test-case reduction, as the crux of the approach is fully generic and should be applicable to any random generator of test cases.
Date Issued
2020-11-06
Date Acceptance
2020-11-01
Citation
Leibniz International Proceedings in Informatics, LIPIcs, 2020, 166, pp.1-27
ISBN
9783959771542
ISSN
1868-8969
Publisher
DROPS
Start Page
1
End Page
27
Journal / Book Title
Leibniz International Proceedings in Informatics, LIPIcs
Volume
166
Copyright Statement
© David R. MacIver and Alastair F. Donaldson;
licensed under Creative Commons License CC-BY
34th European Conference on Object-Oriented Programming (ECOOP 2020).
licensed under Creative Commons License CC-BY
34th European Conference on Object-Oriented Programming (ECOOP 2020).
License URL
Identifier
https://drops.dagstuhl.de/opus/volltexte/2020/13170/
Source
34th European Conference on Object-Oriented Programming (ECOOP 2020)
Publication Status
Published
Start Date
2020-11-15
Finish Date
2020-11-17
Coverage Spatial
Berlin, Germany
Date Publish Online
2020-11-06