Report Open Access

Evolutionary Improvement of Assertion Oracles

Valerio Terragni; Gunel Jahangirova; Mauro Pezzè; Paolo Tonella

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
776.6 kB Download
All versions This version
Views 2626
Downloads 4848
Data volume 37.3 MB37.3 MB
Unique views 2222
Unique downloads 4444


Cite as