Git Product home page Git Product logo

kotlinx-kover's Introduction

Kover

Kotlin Alpha JetBrains incubator project GitHub license

Kover is a set of solutions for collecting test coverage of Kotlin code compiled for JVM and Android platforms.

Kover Toolset:

Kover Gradle Plugin

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

A beta version of the plugin is also available. The DSL of this version is unstable and can be changed after receiving feedback. Detailed documentation is in the process of being written, please refer to the migration guide.

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.

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.6"
}
Groovy
plugins {
    id 'org.jetbrains.kotlinx.kover' version '0.7.6'
}

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.

It is also important that after applying Kover Gradle plugin, during the running tests, the classes are modified (instrumented) when loaded into the JVM which may lead to some performance degradation, or affect concurrent tests.

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.6")
    }
}

apply(plugin = "org.jetbrains.kotlinx.kover")
Groovy
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.jetbrains.kotlinx:kover-gradle-plugin:0.7.6'
    }
}
  
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

Kover CLI

Standalone JVM application used for offline instrumentation and generation of human-readable reports.

Documentation of the latest stable release.

Kover offline instrumentation

Offline instrumentation is the modification of class-files stored on disk to measure their coverage.

The ways of offline instrumentation and running of the instrumented applications are described in the documentation.

Kover JVM agent

JVM agent is a jar file that modifies the bytecode of loaded into the JVM classes in order to measure coverage.

It was added in the beta version. documentations

Kover features artifact

A JVM dependency that allows to programmatically instrument class-files on a disk.

Documentation of the latest stable release

Building locally and Contributing

See Contributing Guidelines.

kotlinx-kover's People

Contributors

shanshin avatar asemy avatar ninodlc avatar nuhkoca avatar ezard avatar soywiz avatar etolstoy avatar ignatberesnev avatar jordanterry avatar jsoberg avatar whyoleg avatar hqsz avatar shoheikawano avatar johnjohndoe avatar qwwdfsad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.