Kotest Pitest Extension
This page introduces the Pitest extension.
The mutation testing tool Pitest integrates with Kotest through an extension module.
Gradle configuration
After configuring Pitest, also add the io.kotest.extensions:kotest-extensions-pitest module to your dependencies:
testImplementation("io.kotest.extensions:kotest-extensions-pitest:<version>")
NOTE: Because Pitest is an extension, it uses a different Maven group name,
io.kotest.extensions, from the core modules.
Then you need to tell Pitest that you will use Kotest as the test plugin:
// Assuming that you have already configured the Gradle/Maven extension
configure<PitestPluginExtension> {
// testPlugin.set("Kotest") // needed only with old PIT <1.6.7, otherwise having kotest-extensions-pitest on classpath is enough
targetClasses.set(listOf("my.company.package.*"))
}
Maven configuration
First, configure the Maven Pitest plugin:
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>${pitest-maven.version}</version>
<configuration>
<targetClasses>...</targetClasses>
<coverageThreshold>...</coverageThreshold>
... other configurations as needed
</configuration>
</plugin>
Then add a dependency on the Pitest Kotest extension:
<dependencies>
... the other Kotest dependencies like kotest-runner-junit5-jvm
<dependency>
<groupId>io.kotest.extensions</groupId>
<artifactId>kotest-extensions-pitest</artifactId>
<version>${kotest-extensions-pitest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
This is enough to run Pitest and obtain reports as described in the Maven Pitest plugin documentation.