Skip to content

Commit

Permalink
Add JaCoCo plugin to collect test coverage
Browse files Browse the repository at this point in the history
Configure [jacoco][1] to gather basic instruction and branch coverage
metrics after each run of the test suite.

[1]: https://docs.gradle.org/current/userguide/jacoco_plugin.html
  • Loading branch information
renatocf committed Jul 16, 2022
1 parent 815fe9a commit c2f44e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ plugins {

// Apply the Test Logger plugin to print test results in the test task.
id("com.adarshr.test-logger") version "3.2.0"

// Apply the Kover plugin to better support Kotlin code coverage.
id("org.jetbrains.kotlinx.kover") version "0.5.0"

// Apply the Jacoco plugin to generate test coverage.
jacoco
}

repositories {
Expand Down Expand Up @@ -66,4 +72,10 @@ testlogger {
// Enable support to JUnit Platform to execute JUnit 5 tests.
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}

// Require tests to run before generating the Jacoco test coverage report.
tasks.jacocoTestReport {
dependsOn(tasks.test)
}

0 comments on commit c2f44e4

Please sign in to comment.