EvoSpex: An Evolutionary Algorithm for Learning Postconditions

02/26/2021
by   Facundo Molina, et al.
0

Software reliability is a primary concern in the construction of software, and thus a fundamental component in the definition of software quality. Analyzing software reliability requires a specification of the intended behavior of the software under analysis, and at the source code level, such specifications typically take the form of assertions. Unfortunately, software many times lacks such specifications, or only provides them for scenario-specific behaviors, as assertions accompanying tests. This issue seriously diminishes the analyzability of software with respect to its reliability. In this paper, we tackle this problem by proposing a technique that, given a Java method, automatically produces a specification of the method's current behavior, in the form of postcondition assertions. This mechanism is based on generating executions of the method under analysis to obtain valid pre/post state pairs, mutating these pairs to obtain (allegedly) invalid ones, and then using a genetic algorithm to produce an assertion that is satisfied by the valid pre/post pairs, while leaving out the invalid ones. The technique, which targets in particular methods of reference-based class implementations, is assessed on a benchmark of open source Java projects, showing that our genetic algorithm is able to generate post-conditions that are stronger and more accurate, than those generated by related automated approaches, as evaluated by an automated oracle assessment tool. Moreover, our technique is also able to infer an important part of manually written rich postconditions in verified classes, and reproduce contracts for methods whose class implementations were automatically synthesized from specifications.

READ FULL TEXT
research
11/20/2018

Automatic Test Improvement with DSpot: a Study with Ten Mature Open-Source Projects

In the literature, there is a rather clear segregation between manually ...
research
01/26/2022

Fuzzing Class Specifications

Expressing class specifications via executable constraints is important ...
research
05/16/2019

Inferring Concise Specifications of APIs

Modern software relies on libraries and uses them via application progra...
research
01/29/2023

Specification Inference for Evolving Systems

In this paper, we propose an assertion-based approach to capture softwar...
research
05/18/2020

Generating Unit Tests for Documentation

Software projects capture information in various kinds of artifacts, inc...
research
11/09/2017

Active Learning of Points-To Specifications

When analyzing programs, large libraries pose significant challenges to ...
research
09/21/2020

Recommending Stack Overflow Posts for Fixing Runtime Exceptions using Failure Scenario Matching

Using online Q A forums, such as Stack Overflow (SO), for guidance to ...

Please sign up or login with your details

Forgot password? Click here to reset