On Context Switching in Spectrum-Based Fault Localization

Read full text
Authors: Roland Aszmann, Péter Attila Soha, Gergő Balogh, Árpád Beszédes, Tibor Gyimóthy
Cited by: 1
References: 38

Abstract

Spectrum-Based Fault Localization (SBFL) helps developers identify faulty code by ranking suspicious elements based on test outcomes and code coverage. In this paper, we examine the impact of context switching— when developers must shift their attention between different parts of the code, such as methods and classes—while traversing the ranked list of suspicious elements. Our study is motivated by the observation that investigating statements located close to each other often requires less effort than switching between distant code locations. To better capture this cost, we introduce a context-aware measure that estimates the effort of fault localization based on the number and frequency of method and class switches. Unlike traditional metrics that consider only the number of examined statements, our measure accounts for the additional burden introduced by context switches. We propose novel algorithms that reorder the ranked list to minimize context switching. Our approach includes context-aware tie-breaking and a carefully designed ordering of classes, methods, and statements for inspection. Experiments on the Defects4J benchmark demonstrate that our technique reduces method and class switches by up to 54%, and also lowers the number of statements investigated—by 15% using the traditional metric and up to 38% using the context-aware metric. Our technique is implemented in a publicly available experimentation framework, enabling configuration of algorithm parameters and exploration of alternative variants for adaptation to different subject systems and scenarios.

Fields of Study & Subjects

Software Testing and Debugging Techniques Software System Performance and Reliability Software Engineering Research

Publication details

Journal / source
IEEE Access
Publisher
Institute of Electrical and Electronics Engineers (IEEE)
Volume
14
Pages
17724–17742
Publication date
1 January 2026
Language
EN