Add Kotlinx Kover test coverage calculator (#199)

* Add Kotlin Kover

* Add AuthKtorConfiguration tests

* Ensure at least 25% code coverage

* Exclude Previews from code coverage

* Specify Kover report path for SonarQube

* Add Kover xml report task

* Extract sonar to a separate step

* Add some exclusions and minimum coverage

* Exclude Hilt-generated classes

* Add shopping list view model tests

* Reduce the coverage requirement
This commit is contained in:
Kirill Kamakin
2024-02-17 10:43:36 +01:00
committed by GitHub
parent 80baf11ec4
commit c03c65a96b
12 changed files with 431 additions and 59 deletions

View File

@@ -84,71 +84,63 @@ ksp {
}
dependencies {
implementation(project(":architecture"))
implementation(project(":database"))
testImplementation(project(":database_test"))
implementation(project(":datastore"))
testImplementation(project(":datastore_test"))
implementation(project(":datasource"))
testImplementation(project(":datasource_test"))
implementation(project(":logging"))
implementation(project(":ui"))
implementation(project(":features:shopping_lists"))
implementation(project(":model_mapper"))
testImplementation(project(":testing"))
implementation(libs.android.material.material)
implementation(libs.androidx.coreKtx)
implementation(libs.androidx.splashScreen)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.lifecycle.viewmodelKtx)
implementation(libs.androidx.shareTarget)
implementation(libs.androidx.compose.materialIconsExtended)
implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(libs.google.dagger.hiltAndroidTesting)
kaptAndroidTest(libs.google.dagger.hiltAndroidCompiler)
androidTestImplementation(libs.google.dagger.hiltAndroidTesting)
implementation(libs.androidx.paging.runtimeKtx)
implementation(libs.androidx.paging.compose)
testImplementation(libs.androidx.paging.commonKtx)
implementation(libs.jetbrains.kotlinx.datetime)
implementation(libs.androidx.datastore.preferences)
implementation(libs.coil)
implementation(libs.coil.compose)
implementation(libs.androidx.compose.animation)
implementation(libs.androidx.hilt.navigationCompose)
testImplementation(libs.junit)
implementation(libs.jetbrains.kotlinx.coroutinesAndroid)
testImplementation(libs.jetbrains.kotlinx.coroutinesTest)
testImplementation(libs.robolectric)
testImplementation(libs.androidx.test.junit)
testImplementation(libs.androidx.coreTesting)
testImplementation(libs.google.truth)
testImplementation(libs.io.mockk)
debugImplementation(libs.squareup.leakcanary)
kover(project(":model_mapper"))
kover(project(":features:shopping_lists"))
kover(project(":ui"))
kover(project(":logging"))
kover(project(":architecture"))
kover(project(":database"))
kover(project(":datastore"))
kover(project(":datasource"))
kapt(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler)
kaptAndroidTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(project(":datasource_test"))
testImplementation(project(":database_test"))
testImplementation(project(":datastore_test"))
testImplementation(project(":testing"))
testImplementation(libs.androidx.paging.commonKtx)
testImplementation(libs.junit)
testImplementation(libs.jetbrains.kotlinx.coroutinesTest)
testImplementation(libs.robolectric)
testImplementation(libs.androidx.test.junit)
testImplementation(libs.androidx.coreTesting)
testImplementation(libs.google.truth)
testImplementation(libs.io.mockk)
testImplementation(libs.google.dagger.hiltAndroidTesting)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.kaspersky.kaspresso)
@@ -157,5 +149,41 @@ dependencies {
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.google.dagger.hiltAndroidTesting)
androidTestUtil(libs.androidx.test.orchestrator)
}
}
koverReport {
filters {
excludes {
classes(
"gq.kirmanak.mealient.datastore.recipe.AddRecipeInput*", // generated by data store
"*ComposableSingletons*", // generated by Compose
"gq.kirmanak.mealient.database.AppDb_Impl*", // generated by Room
"*Dao_Impl*", // generated by Room
"*Hilt_*", // generated by Hilt
)
packages(
"gq.kirmanak.mealient*.destinations", // generated by Compose destinations
)
annotatedBy(
"androidx.compose.ui.tooling.preview.Preview",
"gq.kirmanak.mealient.ui.preview.ColorSchemePreview",
"androidx.compose.runtime.Composable",
"dagger.Module",
"dagger.internal.DaggerGenerated",
)
}
includes {
packages("gq.kirmanak.mealient")
}
}
androidReports("release") {
verify {
rule {
minBound(30)
}
}
}
}