Perfect Is the Enemy of Test Oracle

02/03/2023
by   Ali Reza Ibrahimzada, et al.
0

Automation of test oracles is one of the most challenging facets of software testing, but remains comparatively less addressed compared to automated test input generation. Test oracles rely on a ground-truth that can distinguish between the correct and buggy behavior to determine whether a test fails (detects a bug) or passes. What makes the oracle problem challenging and undecidable is the assumption that the ground-truth should know the exact expected, correct, or buggy behavior. However, we argue that one can still build an accurate oracle without knowing the exact correct or buggy behavior, but how these two might differ. This paper presents SEER, a learning-based approach that in the absence of test assertions or other types of oracle, can determine whether a unit test passes or fails on a given method under test (MUT). To build the ground-truth, SEER jointly embeds unit tests and the implementation of MUTs into a unified vector space, in such a way that the neural representation of tests are similar to that of MUTs they pass on them, but dissimilar to MUTs they fail on them. The classifier built on top of this vector representation serves as the oracle to generate "fail" labels, when test inputs detect a bug in MUT or "pass" labels, otherwise. Our extensive experiments on applying SEER to more than 5K unit tests from a diverse set of open-source Java projects show that the produced oracle is (1) effective in predicting the fail or pass labels, achieving an overall accuracy, precision, recall, and F1 measure of 93 the labels for the unit test of projects that were not in training or validation set with negligible performance drop, and (3) efficient, detecting the existence of bugs in only 6.5 milliseconds on average.

READ FULL TEXT
research
09/20/2021

Neural Unit Test Suggestions

Testing is widely recognized as an important stage of the software devel...
research
05/26/2023

Towards More Realistic Evaluation for Neural Test Oracle Generation

Effective unit tests can help guard and improve software quality but req...
research
02/13/2023

Adaptive Test Generation Using a Large Language Model

Unit tests play a key role in ensuring the correctness of software. Howe...
research
10/28/2020

Independence Tests Without Ground Truth for Noisy Learners

Exact ground truth invariant polynomial systems can be written for arbit...
research
12/16/2019

Human-In-The-Loop Automatic Program Repair

We introduce Learn2fix, the first human-in-the-loop, semi-automatic repa...
research
11/03/2021

Smells in System User Interactive Tests

Test smells are known as bad development practices that reflect poor des...

Please sign up or login with your details

Forgot password? Click here to reset