计算机科学
正确性
单元测试
语句(逻辑)
软件工程
考试(生物学)
代码覆盖率
测试用例
测试管理方法
软件
人工智能
源代码
测试线束
机器学习
程序设计语言
软件开发
软件建设
古生物学
回归分析
法学
生物
政治学
作者
Cody Watson,Michele Tufano,Kevin Moran,Gabriele Bavota,Denys Poshyvanyk
标识
DOI:10.1145/3377811.3380429
摘要
Software testing is an essential part of the software lifecycle and requires a substantial amount of time and effort. It has been estimated that software developers spend close to 50% of their time on testing the code they write. For these reasons, a long standing goal within the research community is to (partially) automate software testing. While several techniques and tools have been proposed to automatically generate test methods, recent work has criticized the quality and usefulness of the assert statements they generate. Therefore, we employ a Neural Machine Translation (NMT) based approach called Atlas(AuTomatic Learning of Assert Statements) to automatically generate meaningful assert statements for test methods. Given a test method and a focal method (i.e.,the main method under test), Atlas can predict a meaningful assert statement to assess the correctness of the focal method. We applied Atlas to thousands of test methods from GitHub projects and it was able to predict the exact assert statement manually written by developers in 31% of the cases when only considering the top-1 predicted assert. When considering the top-5 predicted assert statements, Atlas is able to predict exact matches in 50% of the cases. These promising results hint to the potential usefulness ofour approach as (i) a complement to automatic test case generation techniques, and (ii) a code completion support for developers, whocan benefit from the recommended assert statements while writing test code.
科研通智能强力驱动
Strongly Powered by AbleSci AI