Efficient Mutation Testing via Pre-Trained Language Models

01/09/2023
by   Ahmed Khanfir, et al.
0

Mutation testing is an established fault-based testing technique. It operates by seeding faults into the programs under test and asking developers to write tests that reveal these faults. These tests have the potential to reveal a large number of faults – those that couple with the seeded ones – and thus are deemed important. To this end, mutation testing should seed faults that are both "natural" in a sense easily understood by developers and strong (have high chances to reveal faults). To achieve this we propose using pre-trained generative language models (i.e. CodeBERT) that have the ability to produce developer-like code that operates similarly, but not exactly, as the target code. This means that the models have the ability to seed natural faults, thereby offering opportunities to perform mutation testing. We realise this idea by implementing μBERT, a mutation testing technique that performs mutation testing using CodeBert and empirically evaluated it using 689 faulty program versions. Our results show that the fault revelation ability of μBERT is higher than that of a state-of-the-art mutation testing (PiTest), yielding tests that have up to 17 of PiTest. Moreover, we observe that μBERT can complement PiTest, being able to detect 47 bugs missed by PiTest, while at the same time, PiTest can find 13 bugs missed by μBERT.

READ FULL TEXT

page 7

page 8

page 9

research
03/07/2022

μBERT: Mutation Testing using Pre-Trained Language Models

We introduce μBERT, a mutation testing tool that uses a pre-trained lang...
research
03/12/2021

Does mutation testing improve testing practices?

Various proxy metrics for test quality have been defined in order to gui...
research
12/06/2022

How to Compare Fuzzers

Fuzzing is a key method to discover vulnerabilities in programs. Despite...
research
08/19/2022

A Two-phase Metamorphic Approach for Testing Industrial Control Systems

We elaborate on a metamorphic approach for testing industrial control sy...
research
02/26/2019

Amortising the Cost of Mutation Based Fault Localisation using Statistical Inference

Mutation analysis can effectively capture the dependency between source ...
research
12/27/2018

Learning How to Mutate Source Code from Bug-Fixes

Mutation testing has been widely accepted as an approach to guide test c...
research
09/14/2017

Empirical Evaluation of Mutation-based Test Prioritization Techniques

We propose and empirically investigate a new test case prioritization te...

Please sign up or login with your details

Forgot password? Click here to reset