Effectively Sampling Higher Order Mutants Using Causal Effect

Saeyoon Oh, Seongmin Lee, Shin Yoo

Abstract

Mutation testing is a powerful but computationally expensive technique for evaluating software test suites. While First Order Mutants (FOMs) are common, Higher Order Mutants (HOMs)—which combine multiple faults—can reveal subtle bugs that individual changes miss. This paper introduces a method to efficiently identify "Strongly Subsuming Higher Order Mutants" (SSHOMs) using Causal Program Dependence Analysis (CPDA). By identifying program elements likely to mask one another's behavior, the proposed heuristics significantly reduce the search space for high-quality mutants. Evaluation on benchmark programs shows that causal-based sampling can find up to 22 times more SSHOMs than random selection.

Introduction

In mutation testing, developers inject small, intentional errors (mutants) into code to verify if their test suite can detect them. A test suite that fails to "kill" a mutant is considered inadequate. However, the field faces two major hurdles: equivalent mutants, which do not change program behavior, and combinatorial explosion. While FOMs involve a single change, the number of possible HOM combinations is astronomical. Most HOMs are easier to kill than their components, but SSHOMs—mutants harder to kill than any of their constituent parts—are rare and highly valuable for testing. This research aims to move away from blind combinatorial sampling toward a guided approach using program causality.

Causal Program Dependence Analysis (CPDA)

The core innovation of this work is applying CPDA to mutant selection. Traditional static analysis identifies dependencies (e.g., "Variable A depends on Variable B"), but CPDA provides a quantitative likelihood of how often a change in one element actually causes a change in another. The authors hypothesize that high causal dependence between two program locations suggests that mutations at those locations are likely to interfere with or mask each other, creating the subtle behavior characteristic of SSHOMs.

To test this, four sampling heuristics were developed:

  • Random: The baseline approach of picking pairs at random.
  • Proportional (Prop): Selecting pairs with a probability proportional to their causal effect score.
  • Descending Sort (Dsort): Selecting the top $n$ pairs with the highest causal effect scores.
  • Maximum Weight Matching (MWM): A graph-theory approach that selects high-causal pairs while ensuring mutations are distributed across the program to maintain diversity.

Experimental Evaluation

The researchers evaluated these heuristics on two C programs: Bill’s Car, a program for calculating parking fees with complex conditional logic, and Schedule, a task-scheduling utility from the Siemens (SIR) benchmark suite.

Algorithm 2: Pseudo-code of the Bill’s Car benchmark, illustrating the nested conditional logic used for mutation.

As shown in Figure 2, the Bill's Car program contains multiple decision points regarding vehicle type and time durations, providing a rich environment for testing how different mutations might mask one another.

Key Results and Insights

The experimental results confirm that causality is a strong proxy for mutant masking. The researchers found that SSHOMs are heavily concentrated in pairs with the highest causal effect scores. In the Bill's Car dataset, nearly 74% of all SSHOMs were located within the top 10% of causal pairs.

Comparison of heuristics across benchmarks showing the number of SSHOMs found and the number of distinct kill vectors (uniqueness).

As illustrated in Figure 4, the Dsort heuristic consistently generated the highest number of SSHOMs—roughly 17 to 22 times more than random sampling. However, a trade-off exists between quantity and diversity. While Dsort finds the most mutants, they tend to be clustered in specific code regions. In contrast, MWM finds fewer total SSHOMs but ensures they represent a wider variety of potential faults, as evidenced by the "distinct kill vectors" metric in Figure 4(b) and 4(d).

Conclusion

By leveraging Causal Program Dependence Analysis, developers can significantly narrow the search space for high-quality Higher Order Mutants. For the "Schedule" program, focusing on the top causal bucket allowed researchers to find 40% of all SSHOMs by examining only 6.85% of possible pairs. Future work will focus on scaling CPDA to larger codebases and exploring higher-order combinations beyond pairs of mutations.

Summary updated

BibTeX
@inproceedings{oh2021effectively,
  author = {Saeyoon Oh and Seongmin Lee and Shin Yoo},
  title = {{Effectively Sampling Higher Order Mutants Using Causal Effect}},
  booktitle = {ICST Workshops},
  year = {2021},
  url = {https://openreview.net/forum?id=H9WhqjuYN4K},
}
Figure