面向粒度的单元测试用例自动生成
Toward Granular Automatic Unit Test Case Generation
摘要:
单元测试验证单个软件组件中是否存在故障。以前的研究一直针对自动生成的单元测试,通过采用随机或基于搜索的算法。尽管这些方法很有效,但它们并没有实现任何允许它们以结构化的方式创建单元测试的策略:实际上,它们的目标是通过优化代码覆盖率等指标来创建测试,而不确保最终的测试遵循良好的设计原则。为了构建自动测试用例生成过程,我们提出了一个两步系统的方法来生成单元测试:我们首先迫使基于搜索的算法来创建测试,覆盖生产代码的各个方法,从而实现所谓的内部方法测试;然后,我们放松约束,使创建内部类测试的目标生产代码方法之间的相互作用。
英文摘要:
Unit testing verifies the presence of faults in individual software components. Previous research has been targeting the automatic generation of unit tests through the adoption of random or search-based algorithms. Despite their effectiveness, these approaches do not implement any strategy that allows them to create unit tests in a structured manner: indeed, they aim at creating tests by optimizing metrics like code coverage without ensuring that the resulting tests follow good design principles. In order to structure the automatic test case generation process, we propose a two-step systematic approach to the generation of unit tests: we first force search-based algorithms to create tests that cover individual methods of the production code, hence implementing the so-called intra-method tests; then, we relax the constraints to enable the creation of intra-class tests that target the interactions among production code methods.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。