I am running tests via Intellij and i have a small problem.
My code looks like that and the test code is not neccessary to show i think.
MenuBarController.kt:
private val logger = KotlinLogging.logger {}
class ExampleClass {
Now if i run the tests via Intellij with coverage i have the problem, that i can see two classes ... Instead of one...
This is happening because the logger creates a class itself which is than allo coverage checked and this i dont want.
Can i exclude it somehow. ? I am using gradle.
Reprudaction code:
import mu.KotlinLogging
private val logger = KotlinLogging.logger {}
class ExampleClass {
var switch = false
fun switchMe() {
switch = !switch
logger.info { switch }
}
}
import io.kotlintest.shouldBe
import io.kotlintest.shouldNotBe
import io.kotlintest.specs.AnnotationSpec
class ExampleClassTest : AnnotationSpec() {
@Test
internal fun testSwitch() {
var exampleClass = ExampleClass()
exampleClass.switch shouldBe false
exampleClass.switchMe()
exampleClass.switch shouldBe true
}
}
If you are okay with only excluding it from the IntelliJ code coverage report, you can edit the run configuration to exclude files you don't want to see in the report: