Leonardo Gallardo
Leonardo Gallardo

Reputation: 45

Pitest not running with Kotlintest tests

I'm using kotlintest in my projects and I want to run mutation testing with pitest.

Already tried using pitest alone and with junit5 plugin, but the result is always:

Found  0 tests


================================================================================
- Statistics
================================================================================
>> Generated 610 mutations Killed 0 (0%)
>> Ran 0 tests (0 tests per mutation)

I'm using:

I know kotlintest supports pitest since v3.3.0 (according here) but I don't know how to make it work.

Any ideas how to make it run properly?

Thanks!

Upvotes: 1

Views: 704

Answers (1)

Vantuz
Vantuz

Reputation: 48

I was able to crack it

For reference see "PIT test-plugins support" section in gradle pitest plugin documentation

First you need to set up your buildscript like this:

buildscript {
   repositories {
       mavenCentral()
   }
   configurations.maybeCreate('pitest')
   dependencies {
       classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.5'
       pitest "io.kotlintest:kotlintest-plugins-pitest:3.4.2"
   }
}

Then you should set PIT plugin name in pitest block

pitest {
    testPlugin = 'KotlinTest'
    // rest of your pitest configuration
}

After that it should work. Hope this helps!

Upvotes: 3

Related Questions