arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2412.12340cs.SE
收藏

一种用于识别 C++ 项目中测试不稳定现象的大语言模型方法

A Large Language Model Approach to Identify Flakiness in C++ Projects

Xin Sun, Daniel Ståhl, Kristian Sandahl

AI总结:

本文提出一种基于大语言模型的方法,通过微调 Mistral-7b、Llama2-7b 和 CodeLlama-7b 模型,在代码层面识别 C++ 项目中不稳定测试的根本原因,实验表明 Mistral-7b 性能最优,为高效调试不稳定测试提供了新途径。

摘要:

回归测试在软件测试中的作用至关重要,因为它能确保任何新的修改都不会破坏软件系统现有的功能和行为。理想的结果是,在不对被测系统进行任何修改的情况下,回归测试应产生相同的结果。然而在实践中,不稳定测试(Flaky Tests)的存在引入了非确定性行为,削弱了回归测试结果的可靠性。在本文中,我们提出了一种基于大语言模型(LLM)的方法,用于在代码层面识别 C++ 项目中不稳定测试的根本原因,旨在帮助开发人员更高效地调试和解决这些问题。我们从 GitHub 仓库中收集并整理了一个全面的 C++ 项目不稳定测试集合。我们在该 C++ 数据集以及一个现有的 Java 数据集上对 Mistral-7b、Llama2-7b 和 CodeLlama-7b 模型进行了微调,并从精确率、召回率、准确率和 F1 分数等方面评估了性能。我们评估了这些模型在不同数据集上的表现,并为研究和工业应用提供了建议。结果表明,我们的模型在 C++ 数据集上表现出不同的性能,而其性能与在 Java 数据集上的表现相当。Mistral-7b 在所有指标上都超过了另外两个模型,取得了 1 的分数。我们的结果证明了大语言模型在准确分类 C++ 和 Java 项目中的测试不稳定现象方面具有卓越能力,为提高实践中不稳定测试调试效率提供了一种有前景的方法。

英文摘要:

The role of regression testing in software testing is crucial as it ensures that any new modifications do not disrupt the existing functionality and behaviour of the software system. The desired outcome is for regression tests to yield identical results without any modifications made to the system being tested. In practice, however, the presence of Flaky Tests introduces non-deterministic behaviour and undermines the reliability of regression testing results. In this paper, we propose an LLM-based approach for identifying the root cause of flaky tests in C++ projects at the code level, with the intention of assisting developers in debugging and resolving them more efficiently. We compile a comprehensive collection of C++ project flaky tests sourced from GitHub repositories. We fine-tune Mistral-7b, Llama2-7b and CodeLlama-7b models on the C++ dataset and an existing Java dataset and evaluate the performance in terms of precision, recall, accuracy, and F1 score. We assess the performance of the models across various datasets and offer recommendations for both research and industry applications. The results indicate that our models exhibit varying performance on the C++ dataset, while their performance is comparable to that of the Java dataset. The Mistral-7b surpasses the other two models regarding all metrics, achieving a score of 1. Our results demonstrate the exceptional capability of LLMs to accurately classify flakiness in C++ and Java projects, providing a promising approach to enhance the efficiency of debugging flaky tests in practice.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑