skip to main content
10.1145/3609022.3609415acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Generation and Refinement of Testing Models

Published:31 August 2023Publication History

ABSTRACT

Writing property-based testing models is a challenging task. This article introduces a new tool, Faktory, which is capable of automatically generating an executable property-based testing model from less complicated sources: normal function type specifications, and traditional function calling contracts using pre- and post-conditions. Concretely, Faktory is an Elixir library which from an API annotated with executable calling contracts written using the Corsa contract checking library, automatically generates a property-based testing model in the form of a state machine implemented using the Makina state machine DSL. In the article we illustrate the functionalities of the Faktory tool using a number of examples. The first one shows how to test a functional data structure; the second shows how to improve test-case generation by reusing test results; and in the third example a stateful key-value storage is tested by first deriving an initial test model using Faktory, and then refining the generated model using the Makina model/state machine extension mechanism.

References

  1. Klaus Alfert. 2015. https://github.com/alfert/propcheck Accessed: 2021-05-06 Google ScholarGoogle Scholar
  2. Thomas Arts, Laura M. Castro, and John Hughes. 2008. Testing Erlang Data Types with Quviq Quickcheck. In Proceedings of the 7th ACM SIGPLAN Workshop on ERLANG (ERLANG ’08). Association for Computing Machinery, New York, NY, USA. 1–8. isbn:9781605580654 https://doi.org/10.1145/1411273.1411275 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Luis Eduardo Bueso de Barrio, Lars-Åke Fredlund, Ángel Herranz, Clara Benac Earle, and Julio Mariño. 2021. Makina: A New QuickCheck State Machine Library. In Proceedings of the 20th ACM SIGPLAN International Workshop on Erlang (Erlang 2021). Association for Computing Machinery, New York, NY, USA. 41–53. isbn:9781450386128 https://doi.org/10.1145/3471871.3472964 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Laura M. Castro, Pablo Lamela, and S. Thompson. 2017. Making Property-Based Testing Easier to Read for Humans. COMPUTING AND INFORMATICS, 35, 4 (2017), Feb., 890–913. https://www.cai.sk/ojs/index.php/cai/article/view/3381 Google ScholarGoogle Scholar
  5. Koen Claessen and John Hughes. 2000. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP ’00). ACM, New York, NY, USA. 268–279. isbn:1-58113-202-6 https://doi.org/10.1145/351240.351266 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Lars-Åke Fredlund, Clara Benac Earle, Ángel Herranz-Nieva, and Julio Mariño-Carballo. 2014. Property-Based Testing of JSON Based Web Services. In 2014 IEEE International Conference on Web Services, ICWS, 2014, Anchorage, AK, USA, June 27 - July 2, 2014. IEEE Computer Society, 704–707. https://doi.org/10.1109/ICWS.2014.110 Google ScholarGoogle ScholarCross RefCross Ref
  7. Alex Gerdes, John Hughes, Nicholas Smallbone, Stefan Hanenberg, Sebastian Ivarsson, and Meng Wang. 2018. Understanding formal specifications through good examples. In Proceedings of the 17th ACM SIGPLAN International Workshop on Erlang, ICFP 2018, St. Louis, MO, USA, September 23-29, 2018, Natalia Chechina and Adrian Francalanza (Eds.). ACM, 13–24. https://doi.org/10.1145/3239332.3242763 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Patrice Godefroid, Adam Kiezun, and Michael Y. Levin. 2008. Grammar-based whitebox fuzzing. In Proceedings of the ACM SIGPLAN 2008 Conference on Programming Language Design and Implementation, Tucson, AZ, USA, June 7-13, 2008, Rajiv Gupta and Saman P. Amarasinghe (Eds.). ACM, 206–215. isbn:978-1-59593-860-2 https://doi.org/10.1145/1375581.1375607 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Patrice Godefroid, Nils Klarlund, and Koushik Sen. 2005. DART: directed automated random testing. In Proceedings of the ACM SIGPLAN 2005 Conference on Programming Language Design and Implementation, Chicago, IL, USA, June 12-15, 2005, Vivek Sarkar and Mary W. Hall (Eds.). ACM, 213–223. isbn:1-59593-056-6 https://doi.org/10.1145/1065010.1065036 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. Hellesøy. 2008. https://cucumber.io/ Accessed: 2023-05-11 Google ScholarGoogle Scholar
  11. John Hughes, Benjamin C. Pierce, Thomas Arts, and Ulf Norell. 2016. Mysteries of DropBox: Property-Based Testing of a Distributed Synchronization Service. In 2016 IEEE International Conference on Software Testing, Verification and Validation (ICST). 135–145. https://doi.org/10.1109/ICST.2016.37 Google ScholarGoogle ScholarCross RefCross Ref
  12. John M. Hughes and Hans Bolinder. 2011. Testing a Database for Race Conditions with QuickCheck. In Proceedings of the 10th ACM SIGPLAN Workshop on Erlang (Erlang ’11). Association for Computing Machinery, New York, NY, USA. 72–77. isbn:9781450308595 https://doi.org/10.1145/2034654.2034667 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Bertrand Meyer. 1992. Applying "Design by Contract". IEEE Computer, 25, 10 (1992), 40–51. https://doi.org/10.1109/2.161279 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Manolis Papadakis and Konstantinos Sagonas. 2011. A PropEr Integration of Types and Function Specifications with Property-Based Testing. In Proceedings of the 10th ACM SIGPLAN Workshop on Erlang (Erlang ’11). Association for Computing Machinery, New York, NY, USA. 39–50. isbn:9781450308595 https://doi.org/10.1145/2034654.2034663 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Sergio Pérez, Luis Eduardo Bueso de Barrio, Ignacio Ballesteros, Ángel Herranz, Julio Mariño, Clara Benac Earle, and Lars-Åke Fredlund. 2022. Executable Contracts for Elixir. In Proceedings of the 21st ACM SIGPLAN International Workshop on Erlang (Erlang 2022). Association for Computing Machinery, New York, NY, USA. 40–46. isbn:9781450394352 https://doi.org/10.1145/3546186.3549930 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Nick Stephens, John Grosen, Christopher Salls, Andrew Dutcher, Ruoyu Wang, Jacopo Corbetta, Yan Shoshitaishvili, Christopher Krügel, and Giovanni Vigna. 2016. Driller: Augmenting Fuzzing Through Selective Symbolic Execution. In Network and Distributed System Security Symposium. https://doi.org/10.14722/ndss.2016.23368 Google ScholarGoogle ScholarCross RefCross Ref
  17. Wiebe-Marten Wijnja. 2022. TypeCheck - Effortless runtime type-checking. https://github.com/Qqwy/elixir-type_check In Elixir EU 2022. Google ScholarGoogle Scholar
  18. Michal Zalewski. 2017. American fuzzy lop. http://lcamtuf.coredump.cx/afl/ Accessed: 2019-05-22 Google ScholarGoogle Scholar

Index Terms

  1. Generation and Refinement of Testing Models

          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
            Erlang 2023: Proceedings of the 22nd ACM SIGPLAN International Workshop on Erlang
            August 2023
            38 pages
            ISBN:9798400702945
            DOI:10.1145/3609022

            Copyright © 2023 ACM

            Publication rights licensed to ACM. ACM acknowledges that this contribution was authored or co-authored by an employee, contractor or affiliate of a national government. As such, the Government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for Government purposes only.

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 31 August 2023

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article

            Acceptance Rates

            Overall Acceptance Rate51of68submissions,75%

            Upcoming Conference

            ICFP '24
          • Article Metrics

            • Downloads (Last 12 months)43
            • Downloads (Last 6 weeks)2

            Other Metrics

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader