Quick Start¶
Get Delta Coverage running in 3 steps.
Prerequisites¶
- Gradle 7.6.4 or newer
- JVM 17 or newer
- A git repository with tests
- Gradle 7.6.4 or newer
- JVM 17 or newer
- A git repository with tests
- JVM 17 or newer
- Coverage binary files (e.g.,
.execfrom JaCoCo) - Compiled class files
- A diff file (unified diff format)
Step 1: Install¶
Add the Delta Coverage plugin to your root project's build.gradle.kts:
Add the Delta Coverage plugin to your root project's build.gradle:
Root project only
The Gradle plugin must be applied to the root project. It automatically discovers all subprojects with tests.
Step 2: Configure Diff Source¶
Tell Delta Coverage what to compare against. The most common setup compares with your main branch:
Step 3: Run Coverage¶
Expected Output¶
The console will show a coverage summary:
+----------------------+----------+----------+--------+
| [test] Delta Coverage Stats |
+----------------------+----------+----------+--------+
| Class | Lines | Branches | Instr. |
+----------------------+----------+----------+--------|
| com.example.MyClass | 85.71% | 75% | 88.24% |
+----------------------+----------+----------+--------+
| Total | 85.71% | 75% | 88.24% |
+----------------------+----------+----------+--------+
HTML reports are generated in build/reports/coverage-reports/delta-coverage/.
What Just Happened?¶
- Test Discovery — The plugin found your test tasks automatically
- Coverage Collection — JaCoCo collected coverage data during tests
- Diff Analysis — Git diff was computed against
origin/main - Filtered Report — Coverage was filtered to show only changed lines
- Test Discovery — The plugin found your test tasks automatically
- Coverage Collection — JaCoCo collected coverage data during tests
- Diff Analysis — Git diff was computed against
origin/main - Filtered Report — Coverage was filtered to show only changed lines
- Diff Parsing — The CLI read your diff file to identify changed lines
- Coverage Loading — Coverage binary files were loaded and analyzed
- Class Matching — Changed files were matched to compiled class files
- Filtered Report — Coverage was filtered to show only changed lines
Next Steps¶
- Configure violation rules to enforce coverage thresholds
- Set up CI integration to run on every PR
- Add PR comments with coverage reports