一句话:提出用 NLP 自动生成遵守类时序约束的单元测试,减少协议违反导致的运行时异常。
许多类在正确使用时需要遵守时序约束,例如迭代器必须先检查是否还有下一元素再请求,否则会抛出 NoSuchElementException。Randoop、EvoSuite 等自动测试生成工具没有时序约束的概念,因此可能随机调用方法并触发仅由协议违反导致的运行时异常,而非真正的软件缺陷。本文提出使用自然语言处理(NLP)自动生成遵守时序约束的单元测试用例,使生成的调用序列符合类的正确使用协议,从而减少这类无意义的异常。摘要未报告具体实验数据;其核心贡献是将时序约束引入单元测试生成流程。
A class may need to obey temporal constraints in order to function correctly. For example, the correct usage protocol for an iterator is to always check whether there is a next element before asking for it; iterating over a collection when there are no items left leads to a NoSuchElementException. Automatic test case generation tools such as Randoop and EvoSuite do not have any notion of these temporal constraints. Generating test cases by randomly invoking methods on a new instance of the class under test may raise run time exceptions that do not necessarily expose software faults, but are rather a consequence of violations of temporal properties.
@inproceedings{paperbot7365,
title = {Call Me Maybe: Using NLP to Automatically Generate Unit Test Cases Respecting Temporal Constraints},
author = {Arianna Blasi and Alessandra Gorla and Michael D. Ernst and Mauro Pezzè},
booktitle = {ASE},
year = {2022},
doi = {10.1145/3551349.3556961}
}