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

Methods2Test:映射到测试用例的焦点方法的数据集

Methods2Test: A dataset of focal methods mapped to test cases

Michele Tufano, Shao Kun Deng, Neel Sundaresan, Alexey Svyatkovskiy

摘要:

单元测试是软件开发过程中必不可少的一部分,它有助于在开发的早期阶段识别源代码的问题并防止回归。机器学习已经成为帮助软件开发人员生成自动化单元测试的可行方法。然而,通过机器学习生成可靠的单元测试用例,这些用例在语义上是正确的,并且能够捕获软件错误或意外行为,这需要大量的、元数据丰富的数据集。在本文中,我们提出了Methods 2 Test:映射到测试用例的焦点方法数据集:映射到相应测试方法的测试用例的大型监督数据集(即,焦点方法)。该数据集包含780,944对JUnit测试和焦点方法,这些测试和焦点方法是从GitHub上托管的91,385个Java开源项目中提取的,这些项目的许可证允许重新分发。创建Methods 2 Test背后的主要挑战是在测试用例和相关焦点方法之间建立可靠的映射。为此,我们设计了一套基于开发人员在软件测试中的最佳实践的方法学,它为给定的测试用例确定了可能的焦点方法。为了便于进一步分析,我们在JSON格式的文件中为每个方法-测试对存储了一组丰富的元数据。此外,我们从不同上下文级别的数据集中提取文本语料库,我们以原始和标记化的形式提供,以使研究人员能够训练和评估自动测试生成的机器学习模型。Methods 2 Test可在https://github.com/microsoft/methods2test上公开获取

英文摘要:

Unit testing is an essential part of the software development process, which helps to identify issues with source code in early stages of development and prevent regressions. Machine learning has emerged as viable approach to help software developers generate automated unit tests. However, generating reliable unit test cases that are semantically correct and capable of catching software bugs or unintended behavior via machine learning requires large, metadata-rich, datasets. In this paper we present Methods2Test: A dataset of focal methods mapped to test cases: a large, supervised dataset of test cases mapped to corresponding methods under test (i.e., focal methods). This dataset contains 780,944 pairs of JUnit tests and focal methods, extracted from a total of 91,385 Java open source projects hosted on GitHub with licenses permitting re-distribution. The main challenge behind the creation of the Methods2Test was to establish a reliable mapping between a test case and the relevant focal method. To this aim, we designed a set of heuristics, based on developers' best practices in software testing, which identify the likely focal method for a given test case. To facilitate further analysis, we store a rich set of metadata for each method-test pair in JSON-formatted files. Additionally, we extract textual corpus from the dataset at different context levels, which we provide both in raw and tokenized forms, in order to enable researchers to train and evaluate machine learning models for Automated Test Generation. Methods2Test is publicly available at: https://github.com/microsoft/methods2test

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

↑