-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,142 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/functionalTest/kotlin/kotlinx/kover/test/functional/cases/MultiModulesTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package kotlinx.kover.test.functional.cases | ||
|
||
import kotlinx.kover.api.* | ||
import kotlinx.kover.test.functional.cases.utils.* | ||
import kotlinx.kover.test.functional.cases.utils.defaultXmlReport | ||
import kotlinx.kover.test.functional.core.BaseGradleScriptTest | ||
import kotlinx.kover.test.functional.core.ProjectType | ||
import kotlin.test.* | ||
|
||
private const val SUBMODULE_NAME = "common" | ||
|
||
internal class MultiModulesTest : BaseGradleScriptTest() { | ||
@Test | ||
fun testAggregateReports() { | ||
builder("Testing the generation of aggregating reports") | ||
.types(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM) | ||
.engines(CoverageEngine.INTELLIJ, CoverageEngine.JACOCO) | ||
.sources("multimodule-user") | ||
.submodule(SUBMODULE_NAME) { | ||
sources("multimodule-common") | ||
} | ||
.dependency( | ||
"implementation(project(\":$SUBMODULE_NAME\"))", | ||
"implementation project(':$SUBMODULE_NAME')" | ||
) | ||
.build() | ||
.run("build") { | ||
xml(defaultXmlReport()) { | ||
assertCounterFullyCovered(classCounter("org.jetbrains.CommonClass")) | ||
assertCounterFullyCovered(classCounter("org.jetbrains.CommonInternalClass")) | ||
assertCounterFullyCovered(classCounter("org.jetbrains.UserClass")) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun testModuleReports() { | ||
builder("Testing the generation of module reports") | ||
.types(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM) | ||
.engines(CoverageEngine.INTELLIJ, CoverageEngine.JACOCO) | ||
.sources("multimodule-user") | ||
.submodule(SUBMODULE_NAME) { | ||
sources("multimodule-common") | ||
} | ||
.dependency( | ||
"implementation(project(\":$SUBMODULE_NAME\"))", | ||
"implementation project(':$SUBMODULE_NAME')" | ||
) | ||
.build() | ||
.run("koverModuleReport") { | ||
xml(defaultXmlModuleReport()) { | ||
assertCounterAbsent(classCounter("org.jetbrains.CommonClass")) | ||
assertCounterAbsent(classCounter("org.jetbrains.CommonInternalClass")) | ||
assertCounterFullyCovered(classCounter("org.jetbrains.UserClass")) | ||
} | ||
|
||
submodule(SUBMODULE_NAME) { | ||
xml(defaultXmlModuleReport()) { | ||
assertCounterFullyCovered(classCounter("org.jetbrains.CommonClass")) | ||
assertCounterFullyCovered(classCounter("org.jetbrains.CommonInternalClass")) | ||
assertCounterAbsent(classCounter("org.jetbrains.UserClass")) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 18 additions & 8 deletions
26
src/functionalTest/kotlin/kotlinx/kover/test/functional/cases/utils/Defaults.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
package kotlinx.kover.test.functional.cases.utils | ||
|
||
import kotlinx.kover.api.* | ||
import kotlinx.kover.test.functional.core.ProjectType | ||
|
||
internal const val DEFAULT_INTELLIJ_KJVM_BINARY = "kover/test.ic" | ||
internal const val DEFAULT_INTELLIJ_KJVM_SMAP = "kover/test.ic.smap" | ||
|
||
internal const val DEFAULT_INTELLIJ_KMP_BINARY = "kover/jvmTest.ic" | ||
internal const val DEFAULT_INTELLIJ_KMP_SMAP = "kover/jvmTest.ic.smap" | ||
internal fun defaultBinaryReport(engine: CoverageEngine, projectType: ProjectType): String { | ||
val extension = if (engine == CoverageEngine.INTELLIJ) "ic" else "exec" | ||
return when (projectType) { | ||
ProjectType.KOTLIN_JVM -> "kover/test.$extension" | ||
ProjectType.KOTLIN_MULTIPLATFORM -> "kover/jvmTest.$extension" | ||
ProjectType.ANDROID -> "kover/jvmTest.$extension" | ||
} | ||
} | ||
|
||
internal const val DEFAULT_JACOCO_KJVM_BINARY = "kover/test.exec" | ||
internal const val DEFAULT_JACOCO_KMP_BINARY = "kover/jvmTest.exec" | ||
internal fun defaultSmapFile(projectType: ProjectType): String { | ||
return defaultBinaryReport(CoverageEngine.INTELLIJ, projectType) + ".smap" | ||
} | ||
|
||
internal const val DEFAULT_XML = "reports/kover/report.xml" | ||
internal const val DEFAULT_HTML = "reports/kover/html" | ||
internal fun defaultXmlReport() = "reports/kover/report.xml" | ||
internal fun defaultHtmlReport() = "reports/kover/html" | ||
|
||
internal fun defaultXmlModuleReport() = "reports/kover/module-xml/report.xml" | ||
internal fun defaultHtmlModuleReport() = "reports/kover/module-html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.