一句话:提出用机器学习模型自动标注单元测试中的 Arrange、Act、Assert 语句,以支持测试理解与维护。
单元测试常采用 AAA 模式,即 Arrange、Action、Assertion,这种结构有助于测试用例的理解、调试和维护。然而真实项目中的测试用例往往较为复杂,AAA 结构并不显式,人工标注测试语句属于 Arrange、Action 还是 Assertion 既繁琐又耗时。本文提出一种自动化方法,利用机器学习模型对现有测试用例中的 AAA 语句进行标注,从而帮助新开发者以及采用集体代码所有权和测试驱动开发实践的项目更好地理解与维护测试代码。摘要主要阐述了动机与方法方向,未给出具体实验设置、评价指标或结果数据。
The AAA pattern, i.e. the Arrangement, Action, and Assertion, is a common and nature layout to create a test case. Following this pattern in test cases may benefit comprehension, debugging, and maintenance. The AAA structure of real-life test cases may not be explicit due to its high complexity. Manually labeling AAA statements in test cases is tedious. Thus, an automated approach for labeling AAA statements in existing test cases could benefit new developers and projects that practice collective code ownership and test driven development.
@inproceedings{paperbot7335,
title = {Automatically Tagging the “AAA” Pattern in Unit Test Cases Using Machine Learning Models},
author = {Chenhao Wei and Lu Xiao and Tingting Yu and Xinyu Chen and Xiao Wang and Sunny Wong and Abigail Clune},
booktitle = {ASE},
year = {2022},
doi = {10.1145/3551349.3559510}
}