Abstract
In property-based testing, a key problem is generating input data that satisfies the precondition of a property. One approach is to attempt to do so automatically, from the definition of the precondition itself. This idea has been realised using the technique of needed narrowing, as in the Lazy SmallCheck system, however in practice this method often leads to excessive backtracking resulting in poor efficiency. To reduce the amount of backtracking, we develop an extension to needed narrowing that allows preconditions to fail faster based on the use of overlapping patterns. We formalise our extension, show how it can be implemented, and demonstrate that it improves efficiency in many cases.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsReferences
Antoy, S., Echahed, R., Hanus, M.: A needed narrowing strategy. J. ACM 47(4), 776–822 (2000)
Christiansen, J., Fischer, S.: EasyCheck — test data for free. In: Garrigue, J., Hermenegildo, M.V. (eds.) FLOPS 2008. LNCS, vol. 4989, pp. 322–336. Springer, Heidelberg (2008). doi:10.1007/978-3-540-78969-7_23
Claessen, K., Duregård, J., Pałka, M.H.: Generating constrained random data with uniform distribution. In: Codish, M., Sumii, E. (eds.) FLOPS 2014. LNCS, vol. 8475, pp. 18–34. Springer, Heidelberg (2014). doi:10.1007/978-3-319-07151-0_2
Claessen, K., Hughes, J.: QuickCheck: a lightweight tool for random testing of Haskell programs. In: International Conference on Functional Programming (2000)
Cockx, J.: Overlapping and Order-Independent Patterns in Type Theory. Ph.D. thesis, Master thesis, KU Leuven (2013)
Cockx, J., Piessens, F., Devriese, D.: Overlapping and order-independent patterns. In: Shao, Z. (ed.) ESOP 2014. LNCS, vol. 8410, pp. 87–106. Springer, Heidelberg (2014). doi:10.1007/978-3-642-54833-8_6
Duregård, J., Jansson, P., Wang, M.: Feat: functional enumeration of algebraic types. In: Haskell Symposium, vol. 47, no. 12 (2012)
Fowler, J.: The overlap check system for property-based testing (2016). https://github.com/JonFowler/OverlapCheck
Fowler, J., Huttom, G.: Towards a theory of reach. In: Serrano, M., Hage, J. (eds.) TFP 2015. LNCS, vol. 9547, pp. 22–39. Springer, Heidelberg (2016). doi:10.1007/978-3-319-39110-6_2
Hanus, M.: A unified computation model for functional and logic programming. In: Symposium on Principles of Programming Languages (1997)
Hanus, M.: Curry - An Integrated Functional Logic Language. Technical report (2016)
Hritcu, C., Hughes, J., Pierce, B.C., Spector-Zabusky, A., Vytiniotis, D., Azevedo de Amorim, A., Lampropoulos, L.: Testing noninterference, quickly. In: ACM SIGPLAN Notices, vol. 48 (2013)
Lindblad, F.: Property directed generation of first-order test data. In: Symposium on the Trends in Functional Programming (2007)
McBride, C., Paterson, R.: Applicative programming with effects. J. Funct. Program. 18(1), 1–13 (2008)
Naylor, M., Runciman, C.: Finding inputs that reach a target expression. In: International Conference on Source Code Analysis and Manipulation (2007)
Naylor, M.F.: Hardware-Assisted and Target-Directed Evaluation of Functional Programs. Ph.D. thesis. University of York (2008)
Pałka, M.H., Claessen, K., Russo, A., Hughes, J.: Testing an optimising compiler by generating random lambda terms. In: International Workshop on Automation of Software Test (2011)
Reich, J.S., Naylor, M., Runciman, C.: Advances in lazy smallcheck. In: Hinze, R. (ed.) IFL 2012. LNCS, vol. 8241, pp. 53–70. Springer, Heidelberg (2013). doi:10.1007/978-3-642-41582-1_4
Runciman, C., Naylor, M., Lindblad, F.: SmallCheck and lazy smallcheck automatic exhaustive testing for small values. In: Symposium on Haskell (2008)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Fowler, J., Hutton, G. (2017). Failing Faster: Overlapping Patterns for Property-Based Testing. In: Lierler, Y., Taha, W. (eds) Practical Aspects of Declarative Languages. PADL 2017. Lecture Notes in Computer Science(), vol 10137. Springer, Cham. https://doi.org/10.1007/978-3-319-51676-9_7
Download citation
DOI: https://doi.org/10.1007/978-3-319-51676-9_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-51675-2
Online ISBN: 978-3-319-51676-9
eBook Packages: Computer ScienceComputer Science (R0)