Skip to content

aSemy/kotlinx-kover

 
 

Repository files navigation

Kover

Kotlin Alpha JetBrains incubator project GitHub license

Kotlin Code Coverage Toolset

For more information about Kover Gradle Plugin, please refer to the documentation of the latest release.

For more information about Kover CLI, please refer to the documentation of the latest release.

Features

  • Collection of code coverage through JVM tests (JS and native targets are not supported yet).
  • Generating HTML and XML reports.
  • Support for Kotlin JVM, Kotlin Multiplatform projects.
  • Support for Kotlin Android projects with build variants (instrumentation tests executing on the Android device are not supported yet).
  • Support mixed Kotlin and Java sources
  • Verification rules with bounds in the Gradle plugin to keep track of coverage.
  • Using JaCoCo library in Gradle plugin as an alternative for coverage measuring and report generation.
  • Offline instrumentation of class files.
  • Instrumentation and report generation using Command Line Interface

Gradle Quickstart

The recommended way of applying Kover is with the plugins DSL.

Minimum supported version of Gradle is 6.8.

Add the following to your top-level build file:

Kotlin
plugins {
     id("org.jetbrains.kotlinx.kover") version "0.7.1"
}
Groovy
plugins {
    id 'org.jetbrains.kotlinx.kover' version '0.7.1'
}

After you applied Kover Gradle plugin, Kover tasks will be created for generating reports and verification. E.g. to generate HTML report for non-Android project run ./gradlew koverHtmlReport - this will automatically start code compilation, execution of instrumented tests, and an HTML report will be generated with measurement results in the build folder.

Legacy Plugin Application

Legacy method of applying plugins can be used if you cannot use the plugins DSL for some reason.

Kotlin
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.1")
    }
}

apply(plugin = "org.jetbrains.kotlinx.kover")
Groovy
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.jetbrains.kotlinx:kover-gradle-plugin:0.7.1'
    }
}
  
apply plugin: 'org.jetbrains.kotlinx.kover'

To create report combining coverage info from different Gradle projects

You have to add dependency on the project, in which the report task will be run

dependencies {
  kover(project(":another:project"))
}

in this case report will be generated for current project joined with :another:project project.

More examples of Gradle plugin applying can be found in example folder

Building locally and Contributing

See Contributing Guidelines.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%