无法使用includeTestsMatching筛选测试

时间:2018-07-06 17:01:13

标签: gradle kotlin junit5

我有一个用Kotlin编写的gradle项目。

在删除已弃用的junit gradle插件时,由于出现此错误,我无法筛选测试:

* What went wrong:
A problem occurred evaluating root project 'the-project'.
> Could not find method includeTestsMatching() for arguments [*MyClassPostfix] on object of type org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter.

我正在使用Gradle 4.8,Kotlin 1.2.51,Junit5 5.2.0和junit-platform-launcher 1.2.0。

build.gradle的相关摘录:

test {
    filter {
        includeTestsMatching '*MyClassPostfix'
    }
    useJUnitPlatform()

    dependsOn 'cleanTest'

    testLogging {
        events "passed", "skipped", "failed"
    }
}

测试课程示例

internal class TestClassMyClassPostfix
{
    @Test
    fun foo()
    {
        assertEquals(0, 0)
    }    
}

0 个答案:

没有答案