instrumentation

abstract fun instrumentation(block: Action<KoverProjectInstrumentation>)(source)

Instrumentation settings for the current Gradle project.

Instrumentation is the modification of classes when they are loaded into the JVM, which helps to determine which code was called and which was not. Instrumentation changes the bytecode of the class, so it may disable some JVM optimizations, slow down performance and concurrency tests, and may also be incompatible with other instrumentation libraries.

For this reason, it may be necessary to fine-tune the instrumentation, for example, disabling instrumentation for problematic classes. Note that such classes would be marked as uncovered because of that.

Example:

instrumentation {
// disable instrumentation of test tasks of all classes
disabledForAll = true

// disable instrumentation of test task `test2`
disabledForTasks.add("test2")

// The coverage of the test1 and test2 tasks will no longer be taken into account in the reports
// as well as these tasks will not be called when generating the report.
// These tasks will not be instrumented even if you explicitly run them
disabledForTestTasks.addAll("test1", "test2")

// disable instrumentation of specified classes in test tasks
excludedClasses.addAll("foo.bar.*Biz", "*\$Generated")
}

Instance to configuring of instrumentation for the current Gradle project.

See details in instrumentation.