Improving Test Distance for Failure Clustering with Hypergraph Modelling

Gabin An, Juyeon Yoon, Joyce Jiyoung Whang, Shin YooarXiv 2021

Abstract

Automated debugging tools often struggle in multi-fault environments due to the "Single Fault Assumption." This paper presents Hybiscus, a novel approach that leverages hypergraph modelling to cluster failing tests by their root causes. By calculating a specialized distance metric ($hdist$) based on component execution frequency, Hybiscus enables parallel debugging and significantly reduces manual effort. Evaluation on real-world benchmarks shows that Hybiscus achieves perfect clustering in 69% of cases and reduces wasted developer effort by up to 82%.

Introduction

Fault Localisation (FL) and Automated Program Repair (APR) are critical for modern software development. However, most existing tools operate under the Single Fault Assumption (SFA), assuming only one bug exists at a time. In large-scale systems, multiple independent bugs often coexist, causing different tests to fail simultaneously. Standard FL tools applied to such systems suffer from "noise," where execution traces of one bug interfere with the localization of another, leading to significant wasted effort. To address this, failing tests must be accurately clustered into groups corresponding to individual root causes.

The Hybiscus Approach

The core innovation of Hybiscus is the use of hypergraph modelling to represent test coverage and calculate distances between test cases.

Hypergraph Representation

Instead of treating test coverage as simple binary vectors, Hybiscus models the relationship between test cases and program components (e.g., lines of code) as a hypergraph.

  • Vertices: Each vertex represents a test case ($t_i$).
  • Hyperedges: Each hyperedge represents a program component ($c_j$). A hyperedge connects all test cases that execute that component.
Table of test cases, execution traces, and pass/fail results.

The $hdist$ Metric

Hybiscus introduces a distance metric, $hdist$, derived from the "linkage" between tests in the hypergraph. Unlike traditional metrics like Jaccard or Hamming distances, $hdist$ incorporates global context:

  1. Component Weighting: Components executed by many tests are considered "noisy" and assigned lower weights. Components executed by fewer tests are more "suspicious" and receive higher weights.
  2. Linkage Calculation: The linkage between two tests is higher if they share highly weighted (rarely executed) components.
  3. Normalization: This linkage is normalized to produce a distance value that reflects the likelihood of two tests sharing a root cause.
Hypergraph model showing test cases as vertices and weighted components as hyperedges.

Clustering and Estimation

Hybiscus employs Agglomerative Hierarchical Clustering (AHC) to group tests. To determine the optimal number of clusters (and thus the estimated number of bugs), it uses the elbow method, identifying the point where the distance between merged clusters increases sharply.

Evaluation and Results

The authors evaluated Hybiscus using multi-fault variants of the Defects4J (Java) and SIR (C) benchmarks, containing up to seven concurrent bugs.

Key Findings

  • Clustering Accuracy: Hybiscus achieved "perfect clustering"—where the number of clusters equals the number of bugs with no misclassifications—in 69% of the test cases. On Java subjects, $hdist$ outperformed Jaccard, Cosine, and RKT in terms of Normalized Mutual Information (NMI).
  • Efficiency: The $hdist$ calculation is roughly linear relative to the number of components. For the Closure project, Hybiscus reduced distance calculation time from over 5 hours (using the previous state-of-the-art RKT) to just 0.49 seconds.
  • Debugging Impact: When integrated with FL tools, Hybiscus saved up to 82% of wasted effort compared to MSeer, the leading multi-fault localization technique.

Discussion and Future Work

Hybiscus demonstrates that global context in test execution is vital for accurate failure clustering. While traditional metrics look at tests in isolation, the hypergraph approach naturally identifies which components are most discriminative.

Future research will address the Single-Cause Assumption, where a single test might fail due to multiple overlapping bugs. The authors also plan to explore different granularities (e.g., method-level vs. statement-level) to further optimize the speed-accuracy trade-off for ultra-large-scale software systems.

Summary updated

BibTeX
@misc{an2021improving,
  author = {Gabin An and Juyeon Yoon and Joyce Jiyoung Whang and Shin Yoo},
  title = {{Improving Test Distance for Failure Clustering with Hypergraph Modelling}},
  year = {2021},
  eprint = {2104.10360},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.10360},
}
Figure