Published January 1, 2020 | Version v1
Report Open

Evolutionary Improvement of Assertion Oracles

  • 1. Università della Svizzera italiana


Assertion oracles are executable boolean expression placed inside the program. A perfect assertion oracle should pass (return true) for all correct executions and fail (return false) for all incorrect executions. The difficulty of manually design or automatically generate perfect oracles often leads to assertions that fail to distinguish between correct and incorrect executions. In other words, they have false positives and false negatives that we call oracle deficiencies.

In this paper, we propose GAssert (Genetic ASSERTion improvement), the first technique to automatically improve assertions oracles. Given an assertion oracle and its oracle deficiencies, GAssert uses a novel evolutionary algorithm that explores the space of possible assertions to identify a new assertion with fewer oracle deficiencies than the original assertion. 

Our empirical evaluation on 34 Java methods from 7 Java code bases shows that GAssert effectively improves assertion oracles. Moreover, GAssert outperforms two baselines (unguided-random and invariant-based oracle improvement) and was competitive with and in some cases even outperformed human improved assertions.



Files (776.6 kB)

Name Size Download all
776.6 kB Preview Download

Additional details

Related works

Is obsoleted by
10.1145/3368089.3409758 (DOI)


PRECRIME – Self-assessment Oracles for Anticipatory Testing 787703
European Commission