skip to main content
10.1145/2001420.2001465acmconferencesArticle/Chapter ViewAbstractPublication PagesisstaConference Proceedingsconference-collections
research-article

High coverage testing of Haskell programs

Published:17 July 2011Publication History

ABSTRACT

This paper presents a new lightweight technique for automatically generating high coverage test suites for Haskell library code. Our approach combines four main features to increase test coverage: (1) automatically inferring the constructors and functions needed to generate test data; (2) using needed narrowing to take advantage of Haskell's lazy evaluation semantics; (3) inspecting elements inside returned data structures through the use of case statements, and (4) efficiently handling polymorphism by lazily instantiating all possible instances.

We have implemented this technique in IRULAN, a fully automatic tool for systematic black-box unit testing of Haskell library code. We have designed IRULAN to generate high coverage test suites and detect common programming errors in the process. We have applied IRULAN to over 50 programs from the spectral and real suites of the nofib benchmark and show that it can effectively generate high-coverage test suites---exhibiting 70.83% coverage for spectral and 59.78% coverage for real---and find errors in these programs.

Our techniques are general enough to be useful for several other types of testing, and we also discuss our experience of using IRULAN for property and regression testing.

References

  1. T. Allwood, S. Peyton Jones, and S. Eisenbach. Finding the Needle: Stack Traces for GHC. In Haskell, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Andoni, D. Daniliuc, S. Khurshid, and D. Marinov. Evaluating the "Small Scope Hypothesis", 2002.Google ScholarGoogle Scholar
  3. Antoy, Echahed, and Hanus. A Needed Narrowing Strategy. JACM: Journal of the ACM, 47, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. P. Boonstoppel, C. Cadar, and D. Engler. RWset: Attacking Path Explosion in Constraint-Based Test Generation. In TACAS, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. C. Boyapati, S. Khurshid, and D. Marinov. Korat: Automated testing based on Java predicates. In ISSTA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C. Cadar, D. Dunbar, and D. R. Engler. KLEE: Unassisted and Automatic Generation of High-Coverage Tests for Complex Systems Programs. In OSDI, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. K. Claessen and J. Hughes. QuickCheck: A lightweight tool for random testing of Haskell programs. In ICFP, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. D. C. Cooper. Theorem proving in arithmetic without multiplication. In Machine Intelligence, 1972.Google ScholarGoogle Scholar
  9. S. Fischer and H. Kuchen. Systematic generation of glass-box test cases for functional logic programs. In PPDP, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. E. Forrester and B. P. Miller. An empirical study of the robustness of windows NT applications using random testing, 2000.Google ScholarGoogle Scholar
  11. A. Gill and C. Runciman. Haskell Program Coverage. In Haskell, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. Godefroid, M. Y. Levin, and D. A. Molnar. Automated Whitebox Fuzz Testing. In NDSS, 2008.Google ScholarGoogle Scholar
  13. B. Korel. Automated test data generation for programs with procedures. In ISSTA, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. F. Lindblad. Property directed generation of first-order test data. In TFP, 2007.Google ScholarGoogle Scholar
  15. B. P. Miller, L. Fredriksen, and B. So. An empirical study of the reliability of UNIX utilities. CACM, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. N. Mitchell and C. Runciman. A Static Checker for Safe Pattern Matching in Haskell. In TFP, 2007.Google ScholarGoogle Scholar
  17. N. Mitchell and C. Runciman. Not All Patterns, But Enough - an automatic verifier for partial but sufficient pattern matching. In Haskell Symposium, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. C. Pacheco and M. D. Ernst. Eclat: Automatic generation and classification of test inputs. In ECOOP 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. C. Pacheco, S. Lahiri, M. Ernst, and T. Ball. Feedback-directed random test generation. Technical Report MSR-TR-2006-125, Microsoft Research, 2006.Google ScholarGoogle Scholar
  20. W. Partain. The nofib benchmark suite of Haskell programs. In Functional Programming, Workshops in Computing, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. S. L. Peyton Jones. The Implementation of Functional Programming Languages. Prentice--Hall, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. C. Runciman, M. Naylor, and F. Lindblad. SmallCheck and Lazy SmallCheck: Automatic exhaustive testing for small values. In Haskell Symposium, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. W. Visser, C. S. Pasareanu, and S. Khurshid. Test input generation with Java PathFinder. In ISSTA, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. J. Yang, P. Twohey, D. Engler, and M. Musuvathi. Using Model Checking to Find Serious File System Errors. In OSDI, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. High coverage 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
    • Published in

      cover image ACM Conferences
      ISSTA '11: Proceedings of the 2011 International Symposium on Software Testing and Analysis
      July 2011
      394 pages
      ISBN:9781450305624
      DOI:10.1145/2001420

      Copyright © 2011 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: 17 July 2011

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate58of213submissions,27%

      Upcoming Conference

      ISSTA '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader