Flaky tests are a common problem in software testing. They produce inconsistent results when executed multiple times on the same code, invalidating the assumption that a test failure indicates a software defect. Recent work on LLM-based test generation has identified flakiness as a potential problem with generated tests. However, its prevalence and underlying causes are unclear. We examined the flakiness of LLM-generated tests in the context of four relational database management systems: SAP HANA, DuckDB, MySQL, and SQLite. We amplified test suites with two LLMs, GPT-4o and Mistral-Large-Instruct-2407, to assess the flakiness of the generated test cases. Our results suggest that generated tests have a slightly higher proportion of flaky tests compared to existing tests. Based on a manual inspection, we found that the most common root cause of flakiness was the reliance of a test on a certain order that is not guaranteed ("unordered collection"), which was present in 72 of 115 flaky tests (63%). Furthermore, both LLMs transferred the flakiness from the existing tests to the newly generated tests via the provided prompt context. Our experiments suggest that flakiness transfer is more prevalent in closed-source systems such as SAP HANA than in open-source systems. Our study informs developers on what types of flakiness to expect from LLM-generated tests. It also highlights the importance of providing LLMs with tailored context when employing LLMs for test generation.


翻译:不稳定测试是软件测试中的常见问题。当同一代码多次执行时,它们会产生不一致的结果,从而破坏了"测试失败即表示软件缺陷"的基本假设。近期基于LLM的测试生成研究已指出不稳定性是生成测试的潜在问题,但其普遍性与根本原因尚不明确。本研究考察了LLM生成测试在四种关系型数据库管理系统(SAP HANA、DuckDB、MySQL和SQLite)中的不稳定性现象。我们使用GPT-4o和Mistral-Large-Instruct-2407两种大语言模型对测试套件进行扩增,以评估生成测试用例的稳定性。实验结果表明,与现有测试相比,生成测试中不稳定测试的比例略高。通过人工检查,我们发现不稳定的最主要根源在于测试依赖未保证的特定顺序("无序集合"),该情况在115个不稳定测试中出现72次(占比63%)。此外,两种LLM均能通过给定的提示上下文,将现有测试中的不稳定性传递至新生成的测试中。实验表明,这种不稳定性传递现象在SAP HANA等闭源系统中比在开源系统中更为普遍。本研究为开发者揭示了LLM生成测试可能产生的不稳定性类型,同时强调了在运用LLM进行测试生成时提供定制化上下文的重要性。

0
下载
关闭预览

相关内容

利用多个大型语言模型:关于LLM集成的调研
专知会员服务
35+阅读 · 2025年2月27日
【新书】使用生成式人工智能进行软件测试
专知会员服务
44+阅读 · 2025年1月6日
【ICLR2024】能检测到LLM产生的错误信息吗?
专知会员服务
25+阅读 · 2024年1月23日
如何检测LLM内容?UCSB等最新首篇《LLM生成内容检测》综述
异常检测(Anomaly Detection)综述
极市平台
20+阅读 · 2020年10月24日
「PPT」深度学习中的不确定性估计
专知
27+阅读 · 2019年7月20日
你的算法可靠吗? 神经网络不确定性度量
专知
40+阅读 · 2019年4月27日
【机器视觉】表面缺陷检测:机器视觉检测技术
产业智能官
25+阅读 · 2018年5月30日
国家自然科学基金
1+阅读 · 2016年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关VIP内容
相关基金
国家自然科学基金
1+阅读 · 2016年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员