Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/3377811.3380399acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article

Quickly generating diverse valid test inputs with reinforcement learning

Published: 01 October 2020 Publication History

Abstract

Property-based testing is a popular approach for validating the logic of a program. An effective property-based test quickly generates many diverse valid test inputs and runs them through a parameterized test driver. However, when the test driver requires strict validity constraints on the inputs, completely random input generation fails to generate enough valid inputs. Existing approaches to solving this problem rely on whitebox or greybox information collected by instrumenting the input generator and/or test driver. However, collecting such information reduces the speed at which tests can be executed. In this paper, we propose and study a black-box approach for generating valid test inputs. We first formalize the problem of guiding random input generators towards producing a diverse set of valid inputs. This formalization highlights the role of a guide which governs the space of choices within a random input generator. We then propose a solution based on reinforcement learning (RL), using a tabular, on-policy RL approach to guide the generator. We evaluate this approach, RLCheck, against pure random input generation as well as a state-of-the-art greybox evolutionary algorithm, on four real-world benchmarks. We find that in the same time budget, RLCheck generates an order of magnitude more diverse valid inputs than the baselines.

References

[1]
2019. Eris: Porting of QuickCheck to PHP. https://github.com/giorgiosironi/eris. Accessed January 28, 2019.
[2]
2019. FsCheck: Random testing for .NET. https://hypothesis.works/. Accessed January 28, 2019.
[3]
2019. Hypothesis for Python. https://hypothesis.works/. Accessed January 28, 2019.
[4]
2019. JSVerify: Property-based testing for JavaScript. https://github.com/jsverify/jsverify. Accessed January 28, 2019.
[5]
2019. PeachFuzzer. https://www.peach.tech. Accessed August 21, 2019.
[6]
2019. Radamsa: a general-purpose fuzzer. https://gitlab.com/akihe/radamsa. Accessed August 21, 2019.
[7]
2019. ScalaCheck: Property-based testing for Scala. https://www.scalacheck.org/. Accessed January 28, 2019.
[8]
2019. test.check: QuickCheck for Clojure. https://github.com/clojure/test.check. Accessed January 28, 2019.
[9]
Cláudio Amaral, Mário Florido, and Vítor Santos Costa. 2014. PrologCheck-property-based testing in Prolog. In International Symposium on Functional and Logic Programming. Springer, 1--17.
[10]
Saswat Anand, Patrice Godefroid, and Nikolai Tillmann. 2008. Demand-driven compositional symbolic execution. In International Conference on Tools and Algorithms for the Construction and Analysis of Systems. Springer, 367--381.
[11]
David Andre and Stuart J. Russell. 2002. State Abstraction for Programmable Reinforcement Learning Agents. In Eighteenth National Conference on Artificial Intelligence. American Association for Artificial Intelligence, USA, 119--125.
[12]
Thanassis Avgerinos, Alexandre Rebert, Sang Kil Cha, and David Brumley. 2014. Enhancing Symbolic Execution with Veritesting. In Proceedings of the 36th International Conference on Software Engineering (ICSE 2014). ACM, New York, NY, USA, 1083--1094.
[13]
Konstantin Böttinger, Patrice Godefroid, and Rishabh Singh. 2018. Deep Reinforcement Fuzzing. CoRR abs/1801.04589 (2018). arXiv:1801.04589 http://arxiv.org/abs/1801.04589
[14]
Chandrasekhar Boyapati, Sarfraz Khurshid, and Darko Marinov. 2002. Korat: Automated Testing Based on Java Predicates. In Proceedings of the 2002 ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA '02). ACM, New York, NY, USA, 123--133.
[15]
Cristian Cadar, Daniel Dunbar, and Dawson Engler. 2008. KLEE: Unassisted and Automatic Generation of High-coverage Tests for Complex Systems Programs. In Proceedings of the 8th USENIX Conference on Operating Systems Design and Implementation (OSDI'08).
[16]
Cristian Cadar and Koushik Sen. 2013. Symbolic execution for software testing: three decades later. Commun. ACM 56, 2 (2013), 82--90.
[17]
Koen Claessen and John Hughes. 2000. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In Proceedings of the 5th ACM SIGPLAN International Conference on Functional Programming (ICFP).
[18]
Lori A. Clarke. 1976. A program testing system. In Proc. of the 1976 annual conference. 488--491.
[19]
David Coppit and Jiexin Lian. 2005. Yagg: An Easy-to-use Generator for Structured Test Inputs. In Proceedings of the 20th IEEE/ACM International Conference on Automated Software Engineering (ASE '05). ACM, New York, NY, USA, 356--359.
[20]
Stephen Dolan. 2017. Property fuzzing for OCaml. https://github.com/stedolan/crowbar. Accessed Jul 23, 2019.
[21]
Roy Emek, Itai Jaeger, Yehuda Naveh, Gadi Bergman, Guy Aloni, Yoav Katz, Monica Farkash, Igor Dozoretz, and Alex Goldin. 2002. X-Gen: A random test-case generator for systems and SoCs. In High-Level Design Validation and Test Workshop, 2002. Seventh IEEE International. IEEE, 145--150.
[22]
Milos Gligoric, Tihomir Gvero, Vilas Jagannath, Sarfraz Khurshid, Viktor Kuncak, and Darko Marinov. 2010. Test generation through programming in UDITA. In Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering - Volume 1, ICSE 2010, Cape Town, South Africa, 1-8 May 2010. 225--234.
[23]
Patrice Godefroid, Adam Kiezun, and Michael Y. Levin. 2008. Grammar-based Whitebox Fuzzing. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '08).
[24]
Patrice Godefroid, Nils Klarlund, and Koushik Sen. 2005. DART: Directed Automated Random Testing. In Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '05).
[25]
Mark Harman. 2007. The current state and future of search based software engineering. In 2007 Future of Software Engineering. IEEE Computer Society, 342--357.
[26]
Mark Harman and Bryan F Jones. 2001. Search-based software engineering. Information and software Technology 43, 14 (2001), 833--839.
[27]
Paul Holser. 2014. junit-quickcheck: Property-based testing, JUnit-style. https://pholser.github.io/junit-quickcheck. Accessed August 21, 2019.
[28]
James C. King. 1976. Symbolic execution and program testing. Commun. ACM 19 (July 1976), 385--394. Issue 7.
[29]
Volodymyr Kuznetsov, Johannes Kinder, Stefan Bucur, and George Candea. 2012. Efficient state merging in symbolic execution. In Acm Sigplan Notices, Vol. 47. ACM, 193--204.
[30]
Leonidas Lampropoulos, Diane Gallois-Wong, Cătălin Hriţcu, John Hughes, Benjamin C. Pierce, and Li-yao Xia. 2017. Beginner's Luck: A Language for Property-based Generators. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). ACM, New York, NY, USA, 114--129.
[31]
Leonidas Lampropoulos, Michael Hicks, and Benjamin C. Pierce. [n.d.]. Coverage Guided, Property Based Testing. Proc. ACM Program. Lang. 2, OOPSLA ([n. d.]).
[32]
Leonidas Lampropoulos, Zoe Paraskevopoulou, and Benjamin C. Pierce. 2017. Generating Good Generators for Inductive Relations. Proc. ACM Program. Lang. 2, POPL, Article 45 (Dec. 2017), 30 pages.
[33]
Andreas Löscher and Konstantinos Sagonas. 2017. Targeted Property-based Testing. In Proceedings of the 26th ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA 2017). ACM, New York, NY, USA, 46--56.
[34]
Phil McMinn. 2011. Search-Based Software Testing: Past, Present and Future. In Proceedings of the 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation Workshops (ICSTW '11). IEEE Computer Society, Washington, DC, USA, 153--163.
[35]
Jan Midtgaard, Mathias Nygaard Justesen, Patrick Kasting, Flemming Nielson, and Hanne Riis Nielson. 2017. Effect-driven QuickChecking of Compilers. Proc. ACM Program. Lang. 1, ICFP (2017).
[36]
Barton P. Miller, Louis Fredriksen, and Bryan So. 1990. An Empirical Study of the Reliability of UNIX Utilities. Commun. ACM 33, 12 (Dec. 1990), 32--44.
[37]
Agustín Mista, Alejandro Russo, and John Hughes. 2018. Branching Processes for QuickCheck Generators. In Proceedings of the 11th ACM SIGPLAN International Symposium on Haskell (Haskell 2018). ACM, New York, NY, USA, 1--13.
[38]
Rohan Padhye, Caroline Lemieux, and Koushik Sen. 2019. JQF: Coverage-guided Property-based Testing in Java. In Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA 2019). ACM, New York, NY, USA, 398--401.
[39]
Rohan Padhye, Caroline Lemieux, Koushik Sen, Mike Papadakis, and Yves Le Traon. 2019. Semantic Fuzzing with Zest. In Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA '19).
[40]
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). ACM, New York, NY, USA, 39--50.
[41]
Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. 2017. Curiosity-driven Exploration by Self-supervised Prediction. In ICML.
[42]
Talia Ringer, Dan Grossman, Daniel Schwartz-Narbonne, and Serdar Tasiran. 2017. A Solver-aided Language for Test Input Generation. Proc. ACM Program. Lang. 1, OOPSLA, Article 91 (Oct. 2017), 24 pages.
[43]
Gary J. Saavedra, Kathryn N. Rodhouse, Daniel M. Dunlavy, and W. Philip Kegelmeyer. 2019. A Review of Machine Learning Applications in Fuzzing. CoRR abs/1906.11133 (2019). arXiv:1906.11133 http://arxiv.org/abs/1906.11133
[44]
Koushik Sen, Darko Marinov, and Gul Agha. 2005. CUTE: A Concolic Unit Testing Engine for C. In Proceedings of the 10th European Software Engineering Conference Held Jointly with 13th ACM SIGSOFT International Symposium on Foundations of Software Engineering (ESEC/FSE-13).
[45]
Koushik Sen, George Necula, Liang Gong, and Wontae Choi. 2015. MultiSE: Multi-path symbolic execution using value summaries. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. ACM, 842--853.
[46]
Richard S. Sutton and Andrew G. Barto. 2018. Reinforcment Learning: An Introduction. MIT Press. http://www.incompleteideas.net/book/ebook/node53.html
[47]
Xuejun Yang, Yang Chen, Eric Eide, and John Regehr. 2011. Finding and Understanding Bugs in C Compilers. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '11).
[48]
Shin Yoo and Mark Harman. 2007. Pareto efficient multi-objective test case selection. In Proceedings of the 2007 international symposium on Software testing and analysis. ACM, 140--150.
[49]
Michał Zalewski. 2014. American Fuzzy Lop. http://lcamtuf.coredump.cx/afl. Accessed January 11, 2019.
[50]
Michał Zalewski. 2014. American Fuzzy Lop Technical Details. http://lcamtuf.coredump.cx/afl/technical_details.txt. Accessed Aug 2019.

Cited By

View all
  • (2024)Reward Augmentation in Reinforcement Learning for Testing Distributed SystemsProceedings of the ACM on Programming Languages10.1145/36897798:OOPSLA2(1928-1954)Online publication date: 8-Oct-2024
  • (2024)Property-Based Testing in PracticeProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3639581(1-13)Online publication date: 20-May-2024
  • (2024)FuzzInMem: Fuzzing Programs via In-memory StructuresProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3639172(1-13)Online publication date: 20-May-2024
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
ICSE '20: Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering
June 2020
1640 pages
ISBN:9781450371216
DOI:10.1145/3377811
This work is licensed under a Creative Commons Attribution International 4.0 License.

Sponsors

In-Cooperation

  • KIISE: Korean Institute of Information Scientists and Engineers
  • IEEE CS

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 October 2020

Check for updates

Badges

Qualifiers

  • Research-article

Conference

ICSE '20
Sponsor:

Acceptance Rates

Overall Acceptance Rate 276 of 1,856 submissions, 15%

Upcoming Conference

ICSE 2025

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)170
  • Downloads (Last 6 weeks)22
Reflects downloads up to 19 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Reward Augmentation in Reinforcement Learning for Testing Distributed SystemsProceedings of the ACM on Programming Languages10.1145/36897798:OOPSLA2(1928-1954)Online publication date: 8-Oct-2024
  • (2024)Property-Based Testing in PracticeProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3639581(1-13)Online publication date: 20-May-2024
  • (2024)FuzzInMem: Fuzzing Programs via In-memory StructuresProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3639172(1-13)Online publication date: 20-May-2024
  • (2024)Crossover in Parametric FuzzingProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3639160(1-12)Online publication date: 20-May-2024
  • (2023)DynSQLProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620514(4949-4965)Online publication date: 9-Aug-2023
  • (2023)Guiding Greybox Fuzzing with Mutation TestingProceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3597926.3598107(929-941)Online publication date: 12-Jul-2023
  • (2023)Learning Deep Semantics for Test CompletionProceedings of the 45th International Conference on Software Engineering10.1109/ICSE48619.2023.00178(2111-2123)Online publication date: 14-May-2023
  • (2023)JITfuzz: Coverage-Guided Fuzzing for JVM Just-in-Time CompilersProceedings of the 45th International Conference on Software Engineering10.1109/ICSE48619.2023.00017(56-68)Online publication date: 14-May-2023
  • (2023)The role of Reinforcement Learning in software testingInformation and Software Technology10.1016/j.infsof.2023.107325164:COnline publication date: 1-Dec-2023
  • (2023)Evaluating seed selection for fuzzing JavaScript enginesEmpirical Software Engineering10.1007/s10664-023-10340-928:6Online publication date: 26-Sep-2023
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media