Identify faults (i.e. defects that could give rise to a failure)
An Observation:
If a test do not cause a particular piece of code to
be executed it can't possibly identify a fault in that
piece of code
Motivation (cont.)
What Test Tools/Harnesses/Frameworks Provide:
A way to write, organize, and run repeatable tests
What They Don't Provide:
A way to identify what pieces of code are and aren't
executed
Overview of EclEmma/JaCoCo
Purpose:
Keep track of the statements and "branches" covered
by a test (either using a test harness or a
driver)
Output:
A hierarchical coverage report
A marked-up source file that indicates the
coverage
A Note About Terminology
EclEmma/JaCoCo:
The number of "branches" is the sum of the number of
possible Boolean values in an expression
Common Usage:
The number of "branches" is the number of edges in the execution
graph (i.e., 2 for a Boolean expression, regardless of the
number of sub-expressions, \(N\))
The number of "conditions" is the sum of the number
of Boolean values (i.e., \(2N\))
The number of "multiple conditions" is the number of possible
combinations (i.e., \(2^N\) in the worst case)
EclEmma/JaCoCo in an IDE
Launching:
There is usually a button to run the tests using EclEmma
(e.g.,
in Eclipse)
Coverage Report:
The hierarchical coverage report is usually available in the IDE
(e.g., in the "Coverage" tab if the Output View in Eclipse)
It only show the instruction coverage (which is comparable to the
statement coverage)
EclEmma/JaCoCo in an IDE (cont.)
Marked-Up Source:
The source code is usually color-coded and marked-up in other
ways
You can usually hover the cursor over the marked-up source
to get more information
This information is far more valuable and important that the
coverage report
Clearing the Mark-Up:
There is usually a button that allows you to
clear the mark-up from the source code
(e.g.,
in Eclipse)
EclEmma/JaCoCo in an IDE (cont.)
Statement Mark-Up:
The statement itself is color-coded (green is fully covered,
yellow is partly covered, red is uncovered)