Mutation Operators for Code Annotations

  • Pedro Pinheiro UFAL
  • José Carlos Viana UFAL
  • Leonardo Fernandes UFPE / IFAL
  • Márcio Ribeiro UFAL
  • Fabiano Ferrari UFSCar
  • Baldoino Fonseca UFAL
  • Rohit Gheyi UFCG

Resumo


Mutation testing is a technique that injects artificial faults to check whether the existing test suite can detect them. To inject the faults, mutation testing tools rely on mutation operators, such as Arithmetic Operator Replacement, Relational Operator Replacement, Statement Deletion, and Overriding Method Rename. Most of the proposed mutation operators have focused on imperative language constructs and object-oriented constructs. However, many projects make use of meta-programming through code annotations, and mutation operators to simulate annotation-related faults are missing. To minimize this problem, in this paper we propose a set of mutation operators capable of simulating annotation-related faults. In particular, we define nine operators. To evaluate our operators, we mined Java projects that make heavy use of annotations to identify annotation-related faults. We analyzed 100 faults and categorized them as "misuse", when the developer does not know how to use the annotations in a proper way; and "wrong annotation parsing", when the developer wrongly parses annotation code (by using refection, for example). Our operators are able to simulate 95 out of the 100 mined faults. In particular, three operators are able to simulate up to 82% of the analyzed faults. As implications for practice, our operators can help developers to improve their test suite and the code responsible for parsing annotated code. Also, they can help developers to avoid annotation-related faults.

Palavras-chave: code annotations, mining bugs, mutation testing
Publicado
17/09/2018
PINHEIRO, Pedro; VIANA, José Carlos; FERNANDES, Leonardo; RIBEIRO, Márcio; FERRARI, Fabiano; FONSECA, Baldoino; GHEYI, Rohit. Mutation Operators for Code Annotations. In: SIMPÓSIO BRASILEIRO DE TESTES DE SOFTWARE SISTEMÁTICO E AUTOMATIZADO (SAST), 3. , 2018, São Carlos/SP. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2018 . p. 77–86.