【问题标题】:Pitest not running with Kotlintest testsPitest 没有运行 Kotlintest 测试
【发布时间】:2019-09-29 22:17:04
【问题描述】:

我在我的项目中使用 kotlintest,我想用 ptest 运行突变测试。

已经尝试单独使用pitest和junit5插件,但结果总是:

Found  0 tests


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

我正在使用:

  • Pitest - 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.5'
  • Pitest junit5 - 'org.pitest:pitest-junit5-plugin:0.9'
  • Koltintest - 'io.kotlintest:kotlintest-runner-junit5:3.4.2'

我知道 kotlintest 从 v3.3.0 开始就支持 Pitest(根据 here),但我不知道如何使它工作。

任何想法如何使它正常运行?

谢谢!

【问题讨论】:

    标签: pitest kotlintest


    【解决方案1】:

    我能破解它

    有关参考,请参阅gradle pitest plugin documentation 中的“PIT 测试插件支持”部分

    首先你需要像这样设置你的buildscript

    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"
       }
    }
    

    那么你应该在pitest块中设置PIT插件名称

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

    之后它应该可以工作了。希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-31
      • 2018-09-13
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-08
      • 1970-01-01
      相关资源
      最近更新 更多