Changed Code Coverage
Changed Code Coverage allows you to focus on the test coverage of the changed code.
Dimensions
New (File) Line Coverage
Calculation Logic:
- git diff between two commits => changed files => changed line numbers (may include comments and blank lines)
- Traverse the changed files’ coverageMap to check if the locations of branchMap, fnMap, and statementMap include the changed line numbers
- Covered definition: The branchMap, fnMap, and statementMap where the changed line numbers are located are all covered
Calculation Formula:
New (File) Line Coverage = Covered (File) Lines / Total New (File) LinesNew Branch Coverage
Calculation Logic:
- git diff between two commits => changed files => changed line numbers
- Traverse the changed files’ coverageMap to check if the locations of branchMap include the changed line numbers
- Covered definition: The branchMap where the changed line numbers are located is covered
Calculation Formula:
New Branch Coverage = Covered Branches / Total New BranchesNew Function Coverage
Calculation Logic:
- git diff between two commits => changed files => changed line numbers
- Traverse the changed files’ coverageMap to check if the locations of fnMap include the changed line numbers
- Covered definition: The fnMap where the changed line numbers are located is covered
Calculation Formula:
New Function Coverage = Covered Functions / Total New FunctionsNew Statement Coverage
Calculation Logic:
- git diff between two commits => changed files => changed line numbers
- Traverse the changed files’ coverageMap to check if the locations of statementMap include the changed line numbers
- Covered definition: The statementMap where the changed line numbers are located is covered Calculation Formula:
New Statement Coverage = Covered Statements / Total New Statements