Code coverage differences of Java bytecode and source code instrumentation tools

Ferenc Horváth, Tamás Gergely, Árpád Beszédes, Dávid Tengeri, Gergő Balogh, Tibor Gyimóthy

Research output: Contribution to journalArticle

2 Citations (Scopus)


Many software testing fields, like white-box testing, test case generation, test prioritization, and fault localization, depend on code coverage measurement. If used as an overall completeness measure, the minor inaccuracies of coverage data reported by a tool do not matter that much; however, in certain situations, they can lead to serious confusion. For example, a code element that is falsely reported as covered can introduce false confidence in the test. This work investigates code coverage measurement issues for the Java programming language. For Java, the prevalent approach to code coverage measurement is using bytecode instrumentation due to its various benefits over source code instrumentation. As we have experienced, bytecode instrumentation-based code coverage tools produce different results than source code instrumentation-based ones in terms of the reported items as covered. We report on an empirical study to compare the code coverage results provided by tools using the different instrumentation types for Java coverage measurement on the method level. In particular, we want to find out how much a bytecode instrumentation approach is inaccurate compared to a source code instrumentation method. The differences are systematically investigated both in quantitative (how much the outputs differ) and in qualitative terms (what the causes for the differences are). In addition, the impact on test prioritization and test suite reduction—a possible application of coverage measurement—is investigated in more detail as well.

Original languageEnglish
Pages (from-to)79-123
Number of pages45
JournalSoftware Quality Journal
Issue number1
Publication statusPublished - Mar 15 2019


  • Code coverage
  • Coverage tools
  • Empirical study
  • Java bytecode instrumentation
  • Source code instrumentation
  • White-box testing

ASJC Scopus subject areas

  • Software
  • Safety, Risk, Reliability and Quality

Fingerprint Dive into the research topics of 'Code coverage differences of Java bytecode and source code instrumentation tools'. Together they form a unique fingerprint.

  • Cite this