一句话:提出 LogCoCo,利用执行日志与程序分析自动估算方法、语句和分支覆盖率,准确率超过 96%。
代码覆盖率是评估和改进测试套件的常用指标,但现有覆盖率工具因工程实现困难、运行时开销大、结果不完整等问题,通常只能用于单元测试和集成测试阶段。本文提出自动化方法 LogCoCo,利用现成的执行日志来估算代码覆盖率。LogCoCo 借助程序分析技术将执行日志与对应的代码路径进行匹配,从而估算方法覆盖、语句覆盖和分支覆盖三种覆盖率准则。作者在一个开源系统 HBase 以及来自百度的五个商业系统上开展了案例研究,覆盖单元测试、集成测试和基准测试等多种测试活动。结果表明,在九组实验中有七组 LogCoCo 的估算准确率超过 96%,且其结果可用于评估和改进现有测试套件。百度的合作方目前正考虑在日常工作中采用 LogCoCo。
Software testing is a widely used technique to ensure the quality of software systems. Code coverage measures are commonly used to evaluate and improve the existing test suites. Based on our industrial and open source studies, existing state-of-the-art code coverage tools are only used during unit and integration testing due to issues like engineering challenges, performance overhead, and incomplete results. To resolve these issues, in this paper we have proposed an automated approach, called LogCoCo, to estimating code coverage measures using the readily available execution logs. Using program analysis techniques, LogCoCo matches the execution logs with their corresponding code paths and estimates three different code coverage criteria: method coverage, statement coverage, and branch coverage. Case studies on one open source system (HBase) and five commercial systems from Baidu and systems show that: (1) the results of LogCoCo are highly accurate (>96% in seven out of nine experiments) under a variety of testing activities (unit testing, integration testing, and benchmarking); and (2) the results of LogCoCo can be used to evaluate and improve the existing test suites. Our collaborators at Baidu are currently considering adopting LogCoCo and use it on a daily basis.
DOI 原文 ·
@inproceedings{paperbot4787,
title = {An automated approach to estimating code coverage measures via execution logs},
author = {Boyuan Chen and Jian Song and Peng Xu and Xing Hu and Zhen Ming (Jack) Jiang},
booktitle = {ASE},
year = {2018},
doi = {10.1145/3238147.3238214}
}