一句话:提出 TCtracer,自动建立方法级与类级的测试到代码可追溯链接,并在四个开源系统上取得高精度。
测试到代码的可追溯性链接刻画测试制品与代码制品之间的关系,有助于同步测试与被测代码、减少测试失败和漏检,并帮助开发者维持系统心智模型、降低架构退化风险。但人工建立和维护这些链接负担重且易出错。本文提出 TCtracer,一种自动建立测试到代码链接的方法与实现。与已有工作不同,TCtracer 同时在方法级和类级操作,既能连接测试与函数,也能连接测试类与被测类;它组合多种新老技术,并利用方法级与类级之间的信息协同流动来提升效果。作者在四个大型、被广泛研究的开源系统上评估 TCtracer,平均而言,测试到函数链接的平均精度均值(MAP)达到 78%,测试类到类链接的 MAP 达到 93%。
Test-to-code traceability links model the relationships between test artefacts and code artefacts. When utilised during the development process, these links help developers to keep test code in sync with tested code, reducing the rate of test failures and missed faults. Test-to-code traceability links can also help developers to maintain an accurate mental model of the system, reducing the risk of architectural degradation when making changes. However, establishing and maintaining these links manually places an extra burden on developers and is error-prone. This paper presents TCtracer, an approach and implementation for the automatic establishment of test-to-code traceability links. Unlike existing work, TCtracer operates at both the method level and the class level, allowing us to establish links between tests and functions, as well as between test classes and tested classes. We improve over existing techniques by combining an ensemble of new and existing techniques and exploiting a synergistic flow of information between the method and class levels. An evaluation of TCtracer using four large, well-studied open source systems demonstrates that, on average, we can establish test-to-function links with a mean average precision (MAP) of 78% and test-class-to-class links with an MAP of 93%.