Skip to main content
QUICK REVIEW

[Paper Review] Fault Localization with Code Coverage Representation Learning

Yi Li, Shaohua Wang|arXiv (Cornell University)|Feb 27, 2021
Software Engineering ResearchComputer Science51 references4 citations
TL;DR

This paper proposes DeepRL4FL, a deep learning approach that treats fault localization as an image pattern recognition problem by leveraging code coverage representation learning, statement dependencies, and source code representations. It achieves state-of-the-art performance, improving top-1 fault localization accuracy by 491.7% over existing statement-level baselines and 206.3% over method-level baselines.

ABSTRACT

In this paper, we propose DeepRL4FL, a deep learning fault localization (FL) approach that locates the buggy code at the statement and method levels by treating FL as an image pattern recognition problem. DeepRL4FL does so via novel code coverage representation learning (RL) and data dependencies RL for program statements. Those two types of RL on the dynamic information in a code coverage matrix are also combined with the code representation learning on the static information of the usual suspicious source code. This combination is inspired by crime scene investigation in which investigators analyze the crime scene (failed test cases and statements) and related persons (statements with dependencies), and at the same time, examine the usual suspects who have committed a similar crime in the past (similar buggy code in the training data). For the code coverage information, DeepRL4FL first orders the test cases and marks error-exhibiting code statements, expecting that a model can recognize the patterns discriminating between faulty and non-faulty statements/methods. For dependencies among statements, the suspiciousness of a statement is seen taking into account the data dependencies to other statements in execution and data flows, in addition to the statement by itself. Finally, the vector representations for code coverage matrix, data dependencies among statements, and source code are combined and used as the input of a classifier built from a Convolution Neural Network to detect buggy statements/methods. Our empirical evaluation shows that DeepRL4FL improves the top-1 results over the state-of-the-art statement-level FL baselines from 173.1% to 491.7%. It also improves the top-1 results over the existing method-level FL baselines from 15.0% to 206.3%.

Motivation & Objective

  • Address the limitations of spectrum-based and mutation-based fault localization, which fail to distinguish between statements executed in both passing and failing test cases.
  • Overcome the shortcomings of existing deep learning FL approaches that rely on summarized suspiciousness scores rather than full code coverage patterns.
  • Improve fault localization accuracy by integrating dynamic code coverage information with static code representations and data dependencies.
  • Enable more effective fault localization at both statement and method levels using end-to-end deep learning on enhanced code coverage matrices.
  • Leverage historical bug data and program structure to improve generalization and detection of subtle or complex faults.

Proposed method

  • Reorder test cases in the code coverage matrix to group those that execute similar statements, enhancing spatial patterns for CNN processing.
  • Apply representation learning to the reordered code coverage matrix to extract discriminative features for faulty vs. non-faulty statements.
  • Model data dependencies between statements using execution and data flow information to enrich suspiciousness scores beyond coverage alone.
  • Learn vector representations of source code using static program structure to complement dynamic coverage and dependency features.
  • Combine code coverage representations, dependency representations, and source code representations into a unified input for a CNN classifier.
  • Train a convolutional neural network to classify statements and methods as buggy or not based on the fused representation input.

Experimental results

Research questions

  • RQ1Can deep representation learning on code coverage matrices improve fault localization accuracy compared to traditional spectrum-based methods?
  • RQ2To what extent do data dependencies among statements enhance fault localization when combined with code coverage patterns?
  • RQ3How does integrating static code representations with dynamic coverage and dependency features affect fault localization performance?
  • RQ4Can a CNN-based model trained on enhanced code coverage matrices outperform existing state-of-the-art fault localization techniques?
  • RQ5How does the proposed approach perform across different programming languages and fault types, especially uncommon or complex bugs?

Key findings

  • DeepRL4FL improves top-1 fault localization accuracy by 491.7% over the best statement-level baseline on the Defects4J dataset.
  • On the ManyBugs dataset, DeepRL4FL achieves a top-1 accuracy of 14.6%, significantly outperforming existing statement-level baselines.
  • For method-level fault localization, DeepRL4FL achieves a top-1 accuracy of 62.0% on Defects4J, representing a 206.3% improvement over existing method-level baselines.
  • The model's performance is sensitive to test case quality; it underperforms when test cases are sparse or crash locations are distant from faulty code.
  • The approach struggles with faults requiring statement additions, as do all baseline methods, indicating a limitation in handling structural code changes.
  • The model performs poorly on short methods due to insufficient statement dependencies, highlighting the importance of program structure in representation learning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.