Flaky tests yield inconsistent results when they are repeatedly executed on the same code revision. They interfere with automated quality assurance of code changes and hinder efficient software testing. Previous work evaluated approaches to train machine learning models to classify flaky tests based on identifiers in the test code. However, the resulting classifiers have been shown to lack generalizability, hindering their applicability in practical environments. Recently, pre-trained Large Language Models (LLMs) have shown the capability to generalize across various tasks. Thus, they represent a promising approach to address the generalizability problem of previous approaches. In this study, we evaluated three LLMs (two general-purpose models, one code-specific model) using three prompting techniques on two benchmark datasets from prior studies on flaky test classification. Furthermore, we manually investigated 50 samples from the given datasets to determine whether classifying flaky tests based only on test code is feasible for humans. Our findings indicate that LLMs struggle to classify flaky tests given only the test code. The results of our best prompt-model combination were only marginally better than random guessing. In our manual analysis, we found that the test code does not necessarily contain sufficient information for a flakiness classification. Our findings motivate future work to evaluate LLMs for flakiness classification with additional context, for example, using retrieval-augmented generation or agentic AI.


翻译:不稳定的测试在相同代码版本上重复执行时会产生不一致的结果。它们干扰代码变更的自动化质量保证,并阻碍高效的软件测试。先前的研究评估了基于测试代码中的标识符训练机器学习模型以分类不稳定测试的方法。然而,这些分类器已被证明缺乏泛化能力,阻碍了其在实际环境中的适用性。近年来,预训练的大语言模型(LLMs)展现出跨任务泛化的能力。因此,它们为解决先前方法的泛化问题提供了有前景的途径。在本研究中,我们使用三种提示技术,在两个先前不稳定测试分类研究的基准数据集上评估了三种大语言模型(两种通用模型,一种代码专用模型)。此外,我们手动分析了给定数据集中的50个样本,以确定仅基于测试代码对人类而言是否可能进行不稳定测试分类。我们的研究结果表明,大语言模型在仅提供测试代码的情况下难以有效分类不稳定测试。最佳提示-模型组合的结果仅略优于随机猜测。在人工分析中,我们发现测试代码本身不一定包含足够的信息以支持不稳定性分类。我们的发现激励未来研究探索在附加上下文(例如使用检索增强生成或智能体式人工智能)条件下评估大语言模型进行不稳定性分类的能力。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【博士论文】小型和大型模型的不确定性估计
专知会员服务
21+阅读 · 2025年7月11日
【PKDD2020教程】机器学习不确定性,附88页ppt与视频
专知会员服务
95+阅读 · 2020年10月18日
您可以相信模型的不确定性吗?
TensorFlow
14+阅读 · 2020年1月31日
「PPT」深度学习中的不确定性估计
专知
27+阅读 · 2019年7月20日
一个牛逼的 Python 调试工具
机器学习算法与Python学习
15+阅读 · 2019年4月30日
你的算法可靠吗? 神经网络不确定性度量
专知
40+阅读 · 2019年4月27日
用模型不确定性理解模型
论智
11+阅读 · 2018年9月5日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
16+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
Arxiv
0+阅读 · 1月27日
VIP会员
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
16+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员