jacoco report header comments

Code coverage

In doing unit testing, code coverage is often used to test as a measure of good or bad, even with code coverage to check testing task completion, for example, code coverage must reach 80% or 90%.

 

 

Jacoco from various angles code analysis, including instructions (Instructions, C0 Coverage), branches (Branches, C1 Coverage), cyclomatic complexity (Cyclomatic Complexity), lines (Lines), method (Methods), class (the Classes) .

1. Instructions

Is calculated minimum unit Jacoco bytecode instructions. Instruction coverage shows that in all the instructions, which are instructions and which had not been executed . The index is completely independent of the source format and is effective in any event, debug information is not required class files.

2. Branches

Jacoco calculated for all the branch coverage if and switch commands. This metric counts all of the number of branches, while expenditures which branch is executed, which branches are not executed . The indicators are also valid in any case. Exception handling is not considered within the scope of the branch.
In the case of debugging information, the branch point may be mapped to each line in the source code, and is represented highlighted.

Red Diamond: No cover, no branch is executed.
Yellow Diamond: cover portion, the branch portion is performed.
Green Diamond: full coverage of all branches is executed.

3. Cyclomatic Complexity

Jacoco cyclomatic complexity calculation for each non-abstract methods, computational complexity and also for each class, package, group. The McCabe1996 defined cyclomatic complexity will be appreciated that the number of test cases to cover all possible cases least used . This parameter is also effective in any case.

4. Lines

The index is calculated in the case of debugging information. Because each line of code can produce several pieces of byte code instructions, so we expressed three different line coverage state

Red background: No cover, all instructions of the bank were not executed.
Yellow: partially covering the line portions instruction is executed.
Green Background: full coverage of the bank all instruction is executed.

5. Methods

Each non-abstract methods, at least one instruction. If a method of at least one instruction is executed, it is considered to be performed. Because direct JaCoco bytecode operation, some method does not display (such as certain construction methods and automatically generated by the compiler method) will be included in the source account.

6. Classes

Each class as long as a method is performed, the class is identified as being executed. With 5 different, some source code is not executed in the method statement, it is said that the class is executed.

JaCoCo principle

Reference URL: http://www.open-open.com/lib/view/open1472174544246.html
which contains the relevant principles and injection probe modified bytecode.

Source Documents: https://www.jianshu.com/p/4c728b39185e

Guess you like

Origin www.cnblogs.com/banml/p/12162913.html