skip to main content
article
Free Access

QuickCheck: a lightweight tool for random testing of Haskell programs

Published:01 September 2000Publication History
Skip Abstract Section

Abstract

Quick Check is a tool which aids the Haskell programmer in formulating and testing properties of programs. Properties are described as Haskell functions, and can be automatically tested on random input, but it is also possible to define custom test data generators. We present a number of case studies, in which the tool was successfully used, and also point out some pitfalls to avoid. Random testing is especially suitable for functional programs because properties can be stated at a fine grain. When a function is built from separately tested components, then random testing suffices to obtain good coverage of the definition under test.

References

  1. 1 S. Antoy and R. Hamlet. Automatically checking an implementation against its formal specification. In Irvine Software Symposium, pages 29-48, March 1992.]]Google ScholarGoogle Scholar
  2. 2 Roland Backhouse, Patrik Jansson, Johan Jeuring, and Lambert Meertens. Generic Programming - An Introduction. In Lecture notes in Computer Science, volume 1608, 1999.]]Google ScholarGoogle Scholar
  3. 3 P. Bjesse, K. Claessen, M. Sheeran, and S. Singh. Lava: Hardware Design in Haskell. In International Conference onFunctional Programming, Baltimore, 1998. ACM.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4 M. Blum and S. Kannan. Designing programs that check their work. In Proc. 21st Symposium on the Theory of Computing, pages 86-97. ACM, May 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 M. Blum, M. Luby, and R. Rubinfeld. Self-testing/correcting with applications to numerical problems. In Proc. 22nd Symposium on the Theory of Computing, pages 73-83. ACM, May 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6 A. Celentano, S. C. Reghizzi, P. Della Vigna, and C. Ghezzi. Compiler testing using a sentence generator. Software Practice &Experience, 10:897-918, 1980.]]Google ScholarGoogle ScholarCross RefCross Ref
  7. 7 K. Claessen and D. Sands. Observable Sharing for Functional Circuit Description. In Asian Computer Science Conference, Phuket, Thailand, 1999. ACM Sigplan.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 M. Davis and H. Putnam. A computing procedure for quanti~cation theory. Journal of the Association for Computing Machinery, 7(3):201-215, 1960.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9 J. Duran and S. Ntafos. An evaluation of random testing. Transactions on Software Engineering, 10(4):438-444, July 1984.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10 J. Gannon, R. Hamlet, and P. McMullin. Data abstraction implementation, specification, and testing. Trans. Prog. Lang. and Systems, (3):211-223, 1981.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 11 D. Hamlet. Random testing. In J. Marciniak, editor, Encyclopedia of Software Engineering, pages 970-978. Wiley, 1994.]]Google ScholarGoogle Scholar
  12. 12 R. Hamlet and R. Taylor. Partition testing does not inspire confidence. Transactions on Software Engineering, 16(12):1402-1411, December 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13 J. Hughes. Why Functional Programming Matters. In D. Turner, editor, Research Topics in Functional Programming. Addison Wesley, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 14 M. P. Jones. The Hugs distribution. Currently available from http://haskell.org/hugs, 1999.]]Google ScholarGoogle Scholar
  15. 15 P. M. Maurer. Generating test data with enhanced context-free grammars. IEEE Software, 7(4):50-56, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16 Gunnar Stalmarck. A System for Determining Propositional Logic Theorems by Applying Values and Rules to Triplets that are Generated from a Formula, 1989. Swedish Patent No. 467 076 (approved 1992), U.S. Patent No. 5 276 897 (1994), European Patent No. 0403 454 (1995).]]Google ScholarGoogle Scholar
  17. 17 Philip Wadler. Theorems for free! In International Conference onFunctional Programming and Computer Architecture, London, September 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 18 Philip Wadler. A prettier printer, March 1998. Draft paper.]]Google ScholarGoogle Scholar
  19. 19 H. Zhu, P. Hall, and J. May. Software unit test coverage and adequacy. Computing Surveys, 29(4):366-427, December 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. QuickCheck: a lightweight tool for random testing of Haskell programs

                Recommendations

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in

                Full Access

                • Published in

                  cover image ACM SIGPLAN Notices
                  ACM SIGPLAN Notices  Volume 35, Issue 9
                  Sept. 2000
                  291 pages
                  ISSN:0362-1340
                  EISSN:1558-1160
                  DOI:10.1145/357766
                  Issue’s Table of Contents
                  • cover image ACM Conferences
                    ICFP '00: Proceedings of the fifth ACM SIGPLAN international conference on Functional programming
                    September 2000
                    294 pages
                    ISBN:1581132026
                    DOI:10.1145/351240

                  Copyright © 2000 ACM

                  Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 September 2000

                  Check for updates

                  Qualifiers

                  • article

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader