Skip to content

Commit

Permalink
Designed and implemented Kover API version 2
Browse files Browse the repository at this point in the history
Resolves #19
Resolves #128
Resolves #168
  • Loading branch information
shanshin committed Jun 16, 2022
1 parent d9e1369 commit 07707f8
Show file tree
Hide file tree
Showing 83 changed files with 3,157 additions and 2,649 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/PublicationMavenCentral.kt
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

import org.gradle.api.*
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,4 +1,4 @@
version=0.5.1
version=0.6.0-SNAPSHOT
group=org.jetbrains.kotlinx

kotlin.code.style=official
Expand Up @@ -14,15 +14,15 @@ internal class AdaptersTests : BaseGradleScriptTest() {
Classes from plugins applied in subproject not accessible for Kover in root project.
Therefore, Kover is forced to use reflection to work with extensions of the kotlin multiplatform plugin.
*/
internalSample("different-plugins")
sampleBuild("different-plugins")
.run("koverMergedXmlReport") {
xml(defaultMergedXmlReport()) {
classCounter("org.jetbrains.CommonClass").assertFullyCovered()
classCounter("org.jetbrains.JvmClass").assertFullyCovered()
}
}

internalSample("different-plugins")
sampleBuild("different-plugins")
.run("koverXmlReport") {
subproject("subproject-multiplatform") {
xml(defaultXmlReport()) {
Expand Down
Expand Up @@ -3,12 +3,25 @@ package kotlinx.kover.test.functional.cases
import kotlinx.kover.test.functional.core.*
import kotlin.test.*

internal class ConfigurationCacheTests: BaseGradleScriptTest() {
internal class ConfigurationCacheTests : BaseGradleScriptTest() {
@Test
fun testConfigCache() {
builder("Testing configuration cache support")
.sources("simple")
.build()
.run("build", "koverMergedReport", "koverMergedVerify", "koverReport", "koverVerify", "--configuration-cache")
val build = diverseBuild()
build.addKoverRootProject {
sourcesFrom("simple")
koverMerged {
enable()
}
}

val runner = build.prepare()
runner.run(
"build",
"koverMergedReport",
"koverMergedVerify",
"koverReport",
"koverVerify",
"--configuration-cache"
)
}
}
Expand Up @@ -7,15 +7,20 @@ import kotlin.test.*
internal class DefaultConfigTests : BaseGradleScriptTest() {
@Test
fun testImplicitConfigs() {
builder("Test implicit default settings")
.languages(GradleScriptLanguage.GROOVY, GradleScriptLanguage.KOTLIN)
.types(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM)
.sources("simple")
.build()
.run("build") {
checkDefaultBinaryReport()
checkDefaultMergedReports()
}
val build = diverseBuild(
languages = ALL_LANGUAGES,
types = ALL_TYPES
)
build.addKoverRootProject {
sourcesFrom("simple")
}
val runner = build.prepare()

runner.run("koverReport") {
checkDefaultBinaryReport()
checkDefaultReports()
}

}

}
@@ -1,6 +1,5 @@
package kotlinx.kover.test.functional.cases

import kotlinx.kover.api.*
import kotlinx.kover.test.functional.cases.utils.*
import kotlinx.kover.test.functional.core.*
import kotlinx.kover.test.functional.core.BaseGradleScriptTest
Expand All @@ -10,47 +9,41 @@ internal class InstrumentationFilteringTests : BaseGradleScriptTest() {

@Test
fun testExclude() {
builder("Test exclusion of classes from instrumentation")
.languages(GradleScriptLanguage.KOTLIN, GradleScriptLanguage.GROOVY)
.types(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM)
.engines(CoverageEngine.INTELLIJ, CoverageEngine.JACOCO)
.sources("simple")
.configTest(
"""excludes = listOf("org.jetbrains.*Exa?ple*")""",
"""excludes = ['org.jetbrains.*Exa?ple*']"""
)
.build()
.run("build") {
xml(defaultMergedXmlReport()) {
classCounter("org.jetbrains.ExampleClass").assertFullyMissed()
classCounter("org.jetbrains.SecondClass").assertCovered()
}
val build = diverseBuild(ALL_LANGUAGES, ALL_ENGINES, ALL_TYPES)
build.addKoverRootProject {
sourcesFrom("simple")
testTasks {
excludes("org.jetbrains.*Exa?ple*")
}
}
val runner = build.prepare()
runner.run("build", "koverXmlReport") {
xml(defaultXmlReport()) {
classCounter("org.jetbrains.ExampleClass").assertFullyMissed()
classCounter("org.jetbrains.SecondClass").assertCovered()
}
}

}

@Test
fun testExcludeInclude() {
builder("Test inclusion and exclusion of classes in instrumentation")
.languages(GradleScriptLanguage.KOTLIN, GradleScriptLanguage.GROOVY)
.types(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM)
.engines(CoverageEngine.INTELLIJ, CoverageEngine.JACOCO)
.sources("simple")
.configTest(
"""includes = listOf("org.jetbrains.*Cla?s")""",
"""includes = ['org.jetbrains.*Cla?s']"""
)
.configTest(
"""excludes = listOf("org.jetbrains.*Exa?ple*")""",
"""excludes = ['org.jetbrains.*Exa?ple*']"""
)
.build()
.run("build") {
xml(defaultMergedXmlReport()) {
classCounter("org.jetbrains.ExampleClass").assertFullyMissed()
classCounter("org.jetbrains.Unused").assertFullyMissed()
classCounter("org.jetbrains.SecondClass").assertCovered()
}
val build = diverseBuild(ALL_LANGUAGES, ALL_ENGINES, ALL_TYPES)
build.addKoverRootProject {
sourcesFrom("simple")
testTasks {
includes("org.jetbrains.*Cla?s")
excludes("org.jetbrains.*Exa?ple*")
}
}
val runner = build.prepare()
runner.run("build", "koverXmlReport") {
xml(defaultXmlReport()) {
classCounter("org.jetbrains.ExampleClass").assertFullyMissed()
classCounter("org.jetbrains.Unused").assertFullyMissed()
classCounter("org.jetbrains.SecondClass").assertCovered()
}
}
}

}

0 comments on commit 07707f8

Please sign in to comment.