English

$\mu$BERT: Mutation Testing using Pre-Trained Language Models

Software Engineering 2022-03-08 v1

Abstract

We introduce μ\muBERT, a mutation testing tool that uses a pre-trained language model (CodeBERT) to generate mutants. This is done by masking a token from the expression given as input and using CodeBERT to predict it. Thus, the mutants are generated by replacing the masked tokens with the predicted ones. We evaluate μ\muBERT on 40 real faults from Defects4J and show that it can detect 27 out of the 40 faults, while the baseline (PiTest) detects 26 of them. We also show that μ\muBERT can be 2 times more cost-effective than PiTest, when the same number of mutants are analysed. Additionally, we evaluate the impact of μ\muBERT's mutants when used by program assertion inference techniques, and show that they can help in producing better specifications. Finally, we discuss about the quality and naturalness of some interesting mutants produced by μ\muBERT during our experimental evaluation.

Keywords

Cite

@article{arxiv.2203.03289,
  title  = {$\mu$BERT: Mutation Testing using Pre-Trained Language Models},
  author = {Renzo Degiovanni and Mike Papadakis},
  journal= {arXiv preprint arXiv:2203.03289},
  year   = {2022}
}