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

EvoSpex: A Search-Based Tool for Postcondition Inference

Published:13 July 2023Publication History

ABSTRACT

Postconditions are predicates that specify the intended behavior of a program by capturing properties about the program state when the program finishes its execution. Although postconditions can help to improve many software reliability analyses, they are seldom found accompanying source code. Thus, tools that assist developers in specifying postconditions are useful. This tool demo paper presents EvoSpex, a tool based on evolutionary computation that automatically infers postconditions of Java methods. Given a target Java method and a test suite for it, our tool executes the test suite to obtain valid pre/post state pairs for the method under analysis. Then, these pairs are mutated to obtain (allegedly) invalid ones, and finally a postcondition assertion characterizing the current method behavior is produced, by using an evolutionary algorithm that searches for an assertion that is satisfied by the valid pre/post state pairs and leaves out the invalid ones. EvoSpex implements a classic genetic algorithm that explores the space of candidate postconditions over a JML-like specification language. The algorithm is guided by a fitness function that aims at precisely capturing the valid state pairs, rejecting the invalid ones, and that also favors more succinct assertions.

References

  1. Earl T. Barr, Mark Harman, Phil McMinn, Muzammil Shahbaz, and Shin Yoo. 2015. The Oracle Problem in Software Testing: A Survey. IEEE Trans. Software Eng., 41, 5 (2015), 507–525. https://doi.org/10.1109/TSE.2014.2372785 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Patrice Chalin, Joseph R. Kiniry, Gary T. Leavens, and Erik Poll. 2005. Beyond Assertions: Advanced Specification and Verification with JML and ESC/Java2. In Formal Methods for Components and Objects, 4th International Symposium, FMCO 2005, Amsterdam, The Netherlands, November 1-4, 2005, Revised Lectures. 342–363. https://doi.org/10.1007/11804192_16 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Robert W. Floyd. 1967. Assigning meanings to programs. In Mathematical Aspects of Computer Science, Proceedings of Symposia in Applied Mathematics 19, J. T. Schwartz (Ed.). Providence. 19–32. Google ScholarGoogle Scholar
  4. Carlo A. Furia, Martin Nordio, Nadia Polikarpova, and Julian Tschannen. 2017. AutoProof: auto-active functional verification of object-oriented programs. Int. J. Softw. Tools Technol. Transf., 19, 6 (2017), 697–716. https://doi.org/10.1007/s10009-016-0419-0 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Charles A. R. Hoare. 1969. An Axiomatic Basis for Computer Programming. Commun. ACM, 12, 10 (1969), 576–580. https://doi.org/10.1145/363235.363259 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Daniel Jackson. 2006. Software Abstractions - Logic, Language, and Analysis. MIT Press. isbn:978-0-262-10114-1 http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10928 Google ScholarGoogle Scholar
  7. Gunel Jahangirova, David Clark, Mark Harman, and Paolo Tonella. 2016. Test oracle assessment and improvement. In Proceedings of the 25th International Symposium on Software Testing and Analysis, ISSTA 2016, Saarbrücken, Germany, July 18-20, 2016, Andreas Zeller and Abhik Roychoudhury (Eds.). ACM, 247–258. https://doi.org/10.1145/2931037.2931062 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Calvin Loncaric, Michael D. Ernst, and Emina Torlak. 2018. Generalized Data Structure Synthesis. In Proceedings of the 40th International Conference on Software Engineering (ICSE ’18). Association for Computing Machinery, New York, NY, USA. 958–968. isbn:9781450356381 https://doi.org/10.1145/3180155.3180211 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Bertrand Meyer. 1997. Object-Oriented Software Construction, 2nd Edition. Prentice-Hall. isbn:0-13-629155-4 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Facundo Molina, Pablo Ponzio, Nazareno Aguirre, and Marcelo F. Frias. 2021. EvoSpex: An Evolutionary Algorithm for Learning Postconditions. In 43rd IEEE/ACM International Conference on Software Engineering, ICSE 2021, Madrid, Spain, 22-30 May 2021. IEEE, 1223–1235. https://doi.org/10.1109/ICSE43902.2021.00112 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Todd W. Schiller and Michael D. Ernst. 2012. Reducing the barriers to writing verified specifications. In Proceedings of the 27th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2012, part of SPLASH 2012, Tucson, AZ, USA, October 21-25, 2012, Gary T. Leavens and Matthew B. Dwyer (Eds.). ACM, 95–112. https://doi.org/10.1145/2384616.2384624 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. EvoSpex: A Search-Based Tool for Postcondition Inference

      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 2023: Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis
        July 2023
        1554 pages
        ISBN:9798400702211
        DOI:10.1145/3597926

        Copyright © 2023 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 the author(s) 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: 13 July 2023

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate58of213submissions,27%

        Upcoming Conference

        ISSTA '24
      • Article Metrics

        • Downloads (Last 12 months)54
        • Downloads (Last 6 weeks)4

        Other Metrics

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader