Is Kotest5 compatible with pitest?

124 Views Asked by At

Is Kotest5 compatible with pitest?

I'm using Kotest5 for my tests with a micronaut application. I am using the gradle-pitest-plugin as well as the Kotest pitest extension like the docs say. However I keep getting an error like enter image description here

The testing dependencies I have declared in my project are

"io.micronaut.test:micronaut-test-kotest5:3.6.2"
"io.kotest:kotest-runner-junit5-jvm:5.3.0"
"io.kotest.extensions:kotest-extensions-pitest:1.1.0"

I am using the following pitest gradle plugin version

'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.9.0'

and my pitest configuration block looks as follows:

pitest {
    targetClasses = ["my.group.*"]  //by default "${project.group}.
    pitestVersion = '1.9.0' //not needed when a default PIT version should be used
    threads = 4
    outputFormats = ['XML', 'HTML']
    timestampedReports = false
}

All the working examples I can find are instances where Kotest 4 is being used, but I can't find any changelogs where that is stated. I haven't tried going back to Kotest 4, and I'm not sure pitest offers enough value for me to do that, but maybe it simply isn't compatible!

2

There are 2 best solutions below

5
henry On

Looking at the kotest pitest plugin repo, it is being built against pitest 1.8.0. There was a major interface change to the test plugin interface in pitest 1.9.0

https://github.com/hcoles/pitest/releases/1.9.0

Until the plugin is updated it can only be used with pitest 1.8.1.

0
Rob Schwartz On

Thanks to Henry, I found there was a regression introduced with Kotest 5.4.0. So I have forced all versions of Kotest in my project to 5.3.2 by doing the following:

allprojects {
    configurations.all {
        resolutionStrategy.eachDependency {
            if (it.requested.group == 'io.kotest') {
                it.useVersion '5.3.2'
            }
        }
    }
}

And then Pitest worked perfectly! So this is not an issue with Pitest or the Pitest Gradle plugin as far as I can tell.

I've opened an issue with kotest and the pitest extension here as well for others to follow.