Efficient Black-Box Fault Localization for System-Level Test Code Using Large Language Models

IF 6 1区 计算机科学 Q1 COMPUTER SCIENCE, SOFTWARE ENGINEERING
IEEE Transactions on Software Engineering Pub Date : 2026-10-01 Epub Date: 2026-06-25 DOI:10.1109/TSE.2026.3707426
Ahmadreza Saboor Yaraghi;Golnaz Gharachorlu;Sakina Fatima;Lionel C. Briand;Ruiyuan Wan;Ruifeng Gao
{"title":"Efficient Black-Box Fault Localization for System-Level Test Code Using Large Language Models","authors":"Ahmadreza Saboor Yaraghi;Golnaz Gharachorlu;Sakina Fatima;Lionel C. Briand;Ruiyuan Wan;Ruifeng Gao","doi":"10.1109/TSE.2026.3707426","DOIUrl":null,"url":null,"abstract":"Fault localization (FL) is a critical step in debugging, which typically relies on repeated executions to pinpoint faulty code regions. However, repeated executions can be impractical in the presence of non-deterministic failures or high execution costs. While recent efforts have leveraged Large Language Models (LLMs) to aid execution-free FL, these have primarily focused on identifying faults in the system-under-test (SUT) rather than in the often complex system-level test code, i.e., the test script for system-level testing. However, the latter is also important, as in practice, many failures are triggered by faulty test code. To overcome these challenges, we introduce a fully static, LLM-driven approach for system-level test code fault localization (TCFL) that does not require executing the test case. Our method uses a single failure execution log to estimate the test’s execution trace through three novel algorithms that identify only code statements likely involved in the failure. This pruned trace, combined with the error message, is used to prompt the LLM to rank potential faulty locations. Our black-box, system-level approach requires no access to the SUT source code and is applicable to complex test scripts that assess full system behavior. We evaluate our technique at the function, block, and line levels using an industrial dataset of faulty Python test cases that were not used in pre-training LLMs. Results show that our best-estimated traces closely match the actual traces, with an F1 score of around 90%. Additionally, pruning the complex system-level test code reduces the LLM’s inference time by up to 34% without any loss in FL performance. Our results further suggest that block-level TCFL offers a practical balance, narrowing the search space while preserving useful context, achieving an 81% hit rate at top-3 (Hit@3). Finally, our TCFL method achieves equal or higher FL accuracy, requiring over 85% less average inference time per test case and 93% fewer tokens than the latest LLM-guided FL method.","PeriodicalId":13324,"journal":{"name":"IEEE Transactions on Software Engineering","volume":"52 10","pages":"2986-3018"},"PeriodicalIF":6.0000,"publicationDate":"2026-10-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"IEEE Transactions on Software Engineering","FirstCategoryId":"94","ListUrlMain":"https://ieeexplore.ieee.org/document/11578348/","RegionNum":1,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2026/6/25 0:00:00","PubModel":"Epub","JCR":"Q1","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

Abstract

Fault localization (FL) is a critical step in debugging, which typically relies on repeated executions to pinpoint faulty code regions. However, repeated executions can be impractical in the presence of non-deterministic failures or high execution costs. While recent efforts have leveraged Large Language Models (LLMs) to aid execution-free FL, these have primarily focused on identifying faults in the system-under-test (SUT) rather than in the often complex system-level test code, i.e., the test script for system-level testing. However, the latter is also important, as in practice, many failures are triggered by faulty test code. To overcome these challenges, we introduce a fully static, LLM-driven approach for system-level test code fault localization (TCFL) that does not require executing the test case. Our method uses a single failure execution log to estimate the test’s execution trace through three novel algorithms that identify only code statements likely involved in the failure. This pruned trace, combined with the error message, is used to prompt the LLM to rank potential faulty locations. Our black-box, system-level approach requires no access to the SUT source code and is applicable to complex test scripts that assess full system behavior. We evaluate our technique at the function, block, and line levels using an industrial dataset of faulty Python test cases that were not used in pre-training LLMs. Results show that our best-estimated traces closely match the actual traces, with an F1 score of around 90%. Additionally, pruning the complex system-level test code reduces the LLM’s inference time by up to 34% without any loss in FL performance. Our results further suggest that block-level TCFL offers a practical balance, narrowing the search space while preserving useful context, achieving an 81% hit rate at top-3 (Hit@3). Finally, our TCFL method achieves equal or higher FL accuracy, requiring over 85% less average inference time per test case and 93% fewer tokens than the latest LLM-guided FL method.
基于大语言模型的系统级测试代码的高效黑匣子故障定位
故障定位(FL)是调试中的关键步骤,它通常依赖于重复执行来精确定位有问题的代码区域。但是,在存在不确定性失败或执行成本高的情况下,重复执行可能是不切实际的。虽然最近的努力利用了大型语言模型(llm)来帮助无执行的FL,但这些主要集中在识别被测试系统(SUT)中的错误,而不是通常复杂的系统级测试代码中的错误,例如,用于系统级测试的测试脚本。然而,后者也很重要,因为在实践中,许多失败是由错误的测试代码触发的。为了克服这些挑战,我们为不需要执行测试用例的系统级测试代码错误定位(TCFL)引入了一个完全静态的、llm驱动的方法。我们的方法使用单个失败执行日志,通过三种新的算法来估计测试的执行轨迹,这些算法只识别可能涉及失败的代码语句。这种经过修剪的跟踪与错误消息相结合,用于提示LLM对潜在的错误位置进行排序。我们的黑盒系统级方法不需要访问SUT源代码,并且适用于评估完整系统行为的复杂测试脚本。我们使用在预训练llm中未使用的错误Python测试用例的工业数据集,在函数、块和行级别评估我们的技术。结果表明,我们的最佳估计轨迹与实际轨迹非常接近,F1得分约为90%。此外,修剪复杂的系统级测试代码将LLM的推理时间减少了34%,而FL的性能没有任何损失。我们的结果进一步表明,块级TCFL提供了一个实际的平衡,在保留有用上下文的同时缩小了搜索空间,在前3名中实现了81%的命中率(Hit@3)。最后,我们的TCFL方法达到了相同或更高的FL精度,与最新的llm引导的FL方法相比,每个测试用例的平均推理时间减少了85%以上,令牌减少了93%。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
IEEE Transactions on Software Engineering
IEEE Transactions on Software Engineering 工程技术-工程:电子与电气
CiteScore
9.70
自引率
10.80%
发文量
724
审稿时长
6 months
期刊介绍: IEEE Transactions on Software Engineering seeks contributions comprising well-defined theoretical results and empirical studies with potential impacts on software construction, analysis, or management. The scope of this Transactions extends from fundamental mechanisms to the development of principles and their application in specific environments. Specific topic areas include: a) Development and maintenance methods and models: Techniques and principles for specifying, designing, and implementing software systems, encompassing notations and process models. b) Assessment methods: Software tests, validation, reliability models, test and diagnosis procedures, software redundancy, design for error control, and measurements and evaluation of process and product aspects. c) Software project management: Productivity factors, cost models, schedule and organizational issues, and standards. d) Tools and environments: Specific tools, integrated tool environments, associated architectures, databases, and parallel and distributed processing issues. e) System issues: Hardware-software trade-offs. f) State-of-the-art surveys: Syntheses and comprehensive reviews of the historical development within specific areas of interest.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书