Mutant reduction based on dominance relation for weak mutation testing

https://doi.org/10.1016/j.infsof.2016.05.001Get rights and content

Abstract

Context: As a fault-based testing technique, mutation testing is effective at evaluating the quality of existing test suites. However, a large number of mutants result in the high computational cost in mutation testing. As a result, mutant reduction is of great importance to improve the efficiency of mutation testing.

Objective: We aim to reduce mutants for weak mutation testing based on the dominance relation between mutant branches.

Method: In our method, a new program is formed by inserting mutant branches into the original program. By analyzing the dominance relation between mutant branches in the new program, the non-dominated one is obtained, and the mutant corresponding to the non-dominated mutant branch is the mutant after reduction.

Results: The proposed method is applied to test ten benchmark programs and six classes from open-source projects. The experimental results show that our method reduces over 80% mutants on average, which greatly improves the efficiency of mutation testing.

Conclusion: We conclude that dominance relation between mutant branches is very important and useful in reducing mutants for mutation testing.

Introduction

Software testing, which is used to seek existing defects or faults in software before it is released to the market, is an important way to improve software quality. Mutation testing is commonly used to evaluate the quality of existing test suites to guide testers how they might be able to improve them [1]. Compared with other structural coverage criteria, test suites that are mutation adequate can reveal more faults [2]. It is noticeable that mutation testing has attracted widespread attention from researchers and developers in both academia and industry.

Mutation testing is a fault-based technique [3], [4], and the related concepts are given as follows. By making a simple syntactic change to the original program, a mutant is generated. A rule used to perform the syntactic changes is called a mutation operator. If a test datum can distinguish the outputs between a mutant and its original program, the mutant is said to be killed. A mutant is equivalent, if it cannot be killed by any test datum. Generally, the adequacy of mutation testing named mutation score is defined as the ratio of the number of killed mutants to the total number of non-equivalent mutants.

In order to optimize the execution of the traditional mutation testing, Howden first proposed weak mutation testing [5]. Instead of checking a mutant after executing the whole program, weak mutation testing checks a mutant immediately after executing the mutated statement.

In mutation testing, mutants are employed to reflect possible real faults in software under test [6], [7], [8]. Many lines of code (LOCs), complicated statements, and a variety of data types [9] in software greatly increase the number of mutants. It results in the high computational cost in mutation testing, therefore the mutant reduction is of great importance and necessity. Although there have been several techniques for mutant reduction [10], [11], [12], [13], [14], [15], [16], their efficiency needs to be further improved.

Just et al. focused on the COR and ROR mutation operators to identify redundant mutants [13]. Kaminski et al. sought a subset of relational operators that subsumes the others to reduce mutants [14]. Focusing only on a subset of mutation operators opens new research directions [13], [14]. Papadakis and Malevris transformed the problem of killing mutants into the problem of covering mutant branches in the new program, and generated test data by conventional approaches [17]. Although it is relatively efficient, a large number of mutants without reduction, will inevitably add high complexity to the new program.

In the previous work on dominance analysis, Marre and Bertolino employed the subsumption relation between entities in a ddgraph (a simplified control flow graph) to seek the minimal set of entities named the spanning set, so as to reduce the number of entities needed to cover [18]. In addition, Ghiduk and Girgis identified the non-dominated nodes in a control flow graph (CFG) by analyzing the dominance relation between nodes [19]. Both the above methods are performed among the original entities (nodes) for structural coverage testing. Different from the above work, we analyze the dominance relation between mutant branches, which are instrumented branches transformed from mutants based on the method presented by Papadakis and Malevris for weak mutation testing, with the aim to reduce the number of mutants, and to improve the efficiency of testing.

Considering all the traditional (method level) mutation operators, we first construct mutant branches based on the statements before and after mutation, and form the new program by fusing all mutant branches into the original program using the method proposed by Papadakis and Malevris [17]. Then, we identify redundant mutants according to the dominated mutant branches after manual analysis with the aid of the dominance relation graph. Mutants associated with the non-dominated ones will remain. The test data that cover the non-dominated mutant branches can also cover all the mutant branches, i.e., kill all the mutants before reduction in weak mutation testing.

The basic idea of defining the dominance relation between mutant branches and applying the dominance relation to reduce mutants was initially reported, with examples on several small programs, at the 2nd Chinese Search Based Software Engineering (CSBSE’2013) workshop [20]. Given the fact that the two-page abstract is preliminary, we have extended the idea in the following four new directions:

  • (1)

    defining four concepts, mutant branch, dominance relation, non-dominated branch, and dominance relation graph;

  • (2)

    presenting two theorems on how to form the non-dominated mutant branch set and identify the non-dominated mutants;

  • (3)

    providing an example throughout the whole paper to intuitively demonstrate the above work;

  • (4)

    evaluating the proposed method by applying it to ten benchmark programs and six classes from open-source projects with various sizes and complexities.

The main contributions of this paper are as follows:

• A method of reducing mutants is proposed for weak mutation testing, which is conducted by analyzing the dominance relation between mutant branches in the new program.

• Four definitions of identifying the dominance relation between mutant branches are provided, and the dominance relation graph is given to describe all the dominance relations in the new program.

• Two theorems of determining the non-dominated mutant branches are given, so as to reduce redundant mutants.

• The proposed method is applied to ten benchmark programs and six classes from open-source projects, and the experimental results suggest that our method reduces over 80% mutants.

Section snippets

Related work

Reducing mutants is of effectiveness to save computational cost for mutation testing. Weak mutation testing is a technique in view of saving execution time. Additionally, there are correlations among statements in a program, and correlation analysis is helpful to mutation testing. This section will review the related work from the above aspects.

The proposed method of reducing mutants

This section describes the method of reducing mutants by the dominance relation. In this method, we first construct mutant branches based on the statements before and after mutation, and a new program is formed by fusing all the mutant branches into the original program. Then, we analyze the dominance relation between mutant branches in the new program. Finally, we obtain the non-dominated mutant branches which correspond to the mutants after reduction.

Experiments

This section performs an experimental study to validate the effectiveness of the proposed method. First, the research questions are raised. Then, the experimental process is given. Finally, the experimental results on benchmark programs and open-source classes are analyzed.

Threats to the validity

This section presents several threats to the validity of our experiments and the methods of addressing them.

Construct validity: Determining the dominance relation between mutant branches is of considerable importance to mutant reduction. In the experiments, we determine the dominance relation by manual analysis. It is clear that testers with different skills and familiarities with a program will give different analysis results for the same pair of branches. To reduce this kind of threats, we

Conclusions

In mutation testing for complex software, there will be a large number of mutants being generated, which leads to a too high computational cost to be practically used. Reducing mutants is proved to be an effective way to improve the efficiency of mutation testing. However, there have been not yet efficient approaches available, which are able to reduce a large number of mutants and maintain a high mutation score at the same time.

We focus on mutant reduction in weak mutation testing, and propose

Acknowledgement

This work is jointly supported by National Natural Science Foundation of China (No. 61375067 and 61203304), Natural Science Foundation of Jiangsu Province (No. BK2012566). We would like to thank Dr. Edward C. Mignot (the formerly Professor of Shandong University) for polishing this paper.

References (54)

  • J.H. Andrews et al.

    Using mutation analysis for assessing and comparing testing coverage criteria

    IEEE Trans. Softw. Eng.

    (2006)
  • R. Just et al.

    Using state infection conditions to detect equivalent mutants and speed up mutation analysis

    Proceedings of Dagstuhl Seminar 13021 Symbolic Methods in Testing

    (2013)
  • R. Just et al.

    Using non-redundant mutation operators and test suite prioritization to achieve efficient and scalable mutation analysis

    Proceedings of 23rd International Symposium on Software Reliability Engineering

    (2012)
  • R. Just et al.

    Do redundant mutants affect the effectiveness and efficiency of mutation analysis

    Proceedings of IEEE 5th International Conference on Software Tesing, Verification and Validation

    (2012)
  • G. Kaminski et al.

    Better predicate testing

    Proceedings of 6th International Workshop on Automation of Software Test

    (2011)
  • M.F. Lau et al.

    An extended fault class hierarchy for specification-based testing

    ACM Trans. Softw. Eng. Methodol.

    (2005)
  • R.H. Untch et al.

    Mutation analysis using mutant schemata

    Proceedings of ACM SIGSOFT International Symposium on Software Testing and Analysis

    (1993)
  • M. Papadakis et al.

    Automatically performing weak mutation with the aid of symbolic execution, concolic testing and search-based testing

    Softw. Qual. J.

    (2011)
  • M. Marre et al.

    Using spanning sets for coverage testing

    IEEE Trans. Softw. Eng.

    (2003)
  • A.S. Ghiduk et al.

    Using genetic algorithms and dominance concepts for generating reduced test data

    Informatica

    (2010)
  • GongD. et al.

    Mutant reduction based on the dominant relation

    Abstract of 2nd Chinese Search Based Software Engineering (CSBSE’2013)

    (2013)
  • A.T. Acree

    On Mutation

    (1980)
  • T. A.

    Budd. Mutation Analysis of Program Test Data

    (1980)
  • A.P. Mathur et al.

    An Empirical Comparison of Mutation and Data Flow Based Test Adequacy Criteria

    Technical Report

    (1993)
  • S. Hussain

    Mutation Clustering

    (2008)
  • A.P. Mathur

    Performance, effectiveness, and reliability issues in software testing

    Proceedings of Computer Software and Applications Conference

    (1991)
  • A.J. Offutt et al.

    An experimental evaluation of selective mutation

    Proceedings of 15th International Conference on Software Engineering

    (1993)
  • Cited by (36)

    • Spectral clustering based mutant reduction for mutation testing

      2021, Information and Software Technology
      Citation Excerpt :

      Untch et al. [68] proposed a schema-based approach for generating one single meta-mutant of containing all mutants. In addition, in order to reduce a large number of mutants, Gong et al. [69] used domain correlation for weak mutation testing. This technology not only effectively reduced mutants, but also improved the efficiency of weak mutation testing, and then reduced the cost of mutation testing.

    • Boundary sampling to boost mutation testing for deep learning models

      2021, Information and Software Technology
      Citation Excerpt :

      Although useful in multiple areas, mutation testing is extremely expensive [35], because it requires generating and executing each mutant against the test suite. One way to alleviate this problem is to reduce the number of generated mutants without significant loss of test effectiveness [55–57]. Jia and Harman [58] introduced the concept of higher order mutant (HOM), which was generated by applying mutation operators more than once.

    • Mutation Testing Advances: An Analysis and Survey

      2019, Advances in Computers
      Citation Excerpt :

      Sun et al. [131] explored the program path space and selected mutants that are as diverse as possible with respect to the paths covering them. Gong et al. [132] selected mutants that structurally dominate the others (covering them results in covering all the others). This work aims at weak mutation and attempts to statically identify dominance relations between the mutants.

    • iBiR: Bug-report-driven Fault Injection

      2023, ACM Transactions on Software Engineering and Methodology
    View all citing articles on Scopus
    View full text