You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// this is necessary if tests are run for debugging, in this case it is more difficult to stop at the test you need when they are executed in parallel and you are not sure on which test the execution will pause
This plugin is a prototype for testing ideas related to an alternative configuration method.
5
+
6
+
The main difference from the existing Kover Gradle Plugin is the reactive content of the report: only those classes and tests that were compiled and executed within the same build get into the report.
7
+
8
+
To use the plugin, just add into a `settings.gradle.kts` file
9
+
```kotlin
10
+
plugins {
11
+
id("org.jetbrains.kotlinx.kover.settings") version "0.8.1"
12
+
}
13
+
```
14
+
**There is no need to apply Kover plugin in other places, the `org.jetbrains.kotlinx.kover` plug-in should not be applied anywhere.**
15
+
16
+
To measure coverage you should pass special `-Pkover` argument to Gradle CLI command and call the command to generate the corresponding report `koverHtmlReport` or `koverXmlReport`.
17
+
Example, if you want to measure the coverage of the `test` task:
18
+
```shell
19
+
./gradlew test -Pkover koverHtmlReport
20
+
```
21
+
22
+
Only those classes that were compiled as part of the current Gradle build are included in the report.
23
+
If no compilation tasks were called in the build, the report will be empty.
24
+
25
+
The report covers only those tests that were run as part of the current build.
26
+
If no tests were called in the assembly, then the coverage for all classes will be 0.
27
+
28
+
## Configuring
29
+
At the moment, Kover Settings Plugin allows to configure reports minimally.
30
+
31
+
There are two ways to configure, using a build script in `settings.gradle.kts` and CLI
32
+
33
+
Acceptable settings in `settings.gradle.kts` and their equivalent in CLI
34
+
```kotlin
35
+
kover {
36
+
// -Pkover
37
+
enableCoverage()
38
+
39
+
reports {
40
+
// -Pkover.classes.from=:a
41
+
includedProjects.add(":a")
42
+
43
+
// -Pkover.classes.from.excludes=:b
44
+
excludedProjects.add(":b")
45
+
46
+
// -Pkover.classes.includes=classes.to.exclude.*
47
+
includedClasses.add("classes.to.include.*")
48
+
49
+
// -Pkover.classes.excludes=classes.to.include.*
50
+
excludedClasses.add("classes.to.exclude.*")
51
+
}
52
+
}
53
+
```
54
+
55
+
For example, the following setting is in `settings.gradle.kts`
56
+
```kotlin
57
+
kover {
58
+
enableCoverage()
59
+
60
+
reports {
61
+
excludedClasses.add("org.test.MyClass*")
62
+
}
63
+
}
64
+
```
65
+
fully equivalent to Gradle CLI arguments `-Pkover -Pkover.classes.excludes=org.test.MyClass*`
66
+
67
+
**Any of the specified settings or DSL is preliminary and can be deleted or changed without maintaining backward compatibility**
Copy file name to clipboardexpand all lines: kover-gradle-plugin/src/functionalTest/kotlin/kotlinx/kover/gradle/plugin/test/functional/cases/ReportsCachingTests.kt
Copy file name to clipboardexpand all lines: kover-gradle-plugin/src/functionalTest/kotlin/kotlinx/kover/gradle/plugin/test/functional/framework/writer/SettingsWriter.kt
+1
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ internal fun FormattedWriter.writePluginManagement(language: ScriptLanguage,
0 commit comments