-
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.
Fixed adding data to an already existing binary report file
If the build cache is not used and the build directory is not cleared before the test run, then the coverage data from previous test runs are merged with the data from the recent run. In this case, the report may include coverage from those tests that were removed in the latest version of the code. To solve this, it is necessary to delete the binary report file before each run of the test task. Fixes #489 PR #490
- Loading branch information
Showing
8 changed files
with
130 additions
and
24 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
48 changes: 48 additions & 0 deletions
48
...onalTest/kotlin/kotlinx/kover/gradle/plugin/test/functional/cases/ReportsUpToDateTests.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,48 @@ | ||
/* | ||
* Copyright 2017-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
package kotlinx.kover.gradle.plugin.test.functional.cases | ||
|
||
import kotlinx.kover.gradle.plugin.test.functional.framework.configurator.BuildConfigurator | ||
import kotlinx.kover.gradle.plugin.test.functional.framework.starter.SlicedGeneratedTest | ||
|
||
internal class ReportsUpToDateTests { | ||
|
||
@SlicedGeneratedTest(allTools = true) | ||
fun BuildConfigurator.testDeleteTest() { | ||
addProjectWithKover { | ||
sourcesFrom("simple") | ||
} | ||
|
||
add("src/test/kotlin/ExtraTestClass.kt") { | ||
""" | ||
package org.jetbrains.serialuser | ||
import org.jetbrains.Unused | ||
import kotlin.test.Test | ||
class AdditionalTest { | ||
@Test | ||
fun extra() { | ||
Unused().functionInUsedClass() | ||
} | ||
} | ||
""".trimMargin() | ||
} | ||
run("koverXmlReport") { | ||
xmlReport { | ||
classCounter("org.jetbrains.Unused").assertCovered() | ||
} | ||
} | ||
|
||
// report should be regenerated if test are deleted | ||
delete("src/test/kotlin/ExtraTestClass.kt") | ||
run("koverXmlReport") { | ||
xmlReport { | ||
classCounter("org.jetbrains.Unused").assertFullyMissed() | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
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
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
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