Mitigating the Uncertainty and Imprecision of Log-Based Code Coverage Without Requiring Additional Logging Statements

Authors - Xiaoyan Xu, Filipe R. Cogo, Shane McIntosh
Venue - IEEE Transactions on Software Engineering, pp. To appear, 2024

Related Tags - TSE 2024 software logging

Abstract - Understanding code coverage is an important precursor to software maintenance activities (e.g., better testing). Although modern code coverage tools provide key insights, they typically rely on code instrumentation, resulting in significant performance overhead. An alternative approach to code instrumentation is to process an application's source code and the associated log traces in tandem. This so-called "log-based code coverage" approach does not impose the same performance overhead as code instrumentation. Chen et al. proposed LogCoCo—a tool that implements log-based code coverage for Java. While LogCoCo breaks important new ground, it has fundamental limitations, namely: uncertainty due to the lack of logging statements in conditional branches, and imprecision caused by dependency injection. In this study, we propose Log2Cov, a tool that generates log-based code coverage for programs written in Python and addresses uncertainty and imprecision issues. We evaluate Log2Cov on three large and active open-source systems. More specifically, we compare the performance of Log2Cov to that of Coverage.py, an instrumentation-based coverage tool for Python. Our results indicate that 1) Log2Cov achieves high precision without introducing runtime overhead; and 2) uncertainty and imprecision can be reduced by up to 11% by statically analyzing the program's source code and execution logs, without requiring additional logging instrumentation from developers. While our enhancements make substantial improvements, we find that future work is needed to handle conditional statements and exception handling blocks to achieve parity with instrumentation-based approaches. We conclude the paper by drawing attention to these promising directions for future work.

Preprint - PDF

Bibtex

@article{xu2024tse,
  Author = {Xiaoyan Xu and Filipe R. Cogo and Shane McIntosh},
  Title = {{Mitigating the Uncertainty and Imprecision of Log-Based Code Coverage Without Requiring Additional Logging Statements}},
  Year = {2024},
  Journal = {IEEE Transactions on Software Engineering},
  
  
  Pages = {To appear}
}