小编Ada*_*dam的帖子

未找到给定包含的测试(IntelliJ 和 Groovy)

我正在尝试使用 IntelliJ 和 ./gradlew 命令运行用 Groovy 编写的单元测试。构建项目工作正常,但似乎没有找到测试。在 IntelliJ 中运行测试会抛出以下代码:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [path.to.SomeTestClass](filter.includeTestsMatching)
Run Code Online (Sandbox Code Playgroud)

我的项目中没有找到测试,下面是我在项目 src -> main -> test -> groovy目录下创建的示例类。

import spock.lang.Specification

class SomeTestClass extends Specification {

    def "A test that should work"() {

        given:
        def someNumber = 1

        when:
        def anotherNumber = someNumber + 1

        then:
        anotherNumber == 2
    }
}
Run Code Online (Sandbox Code Playgroud)

将不胜感激任何帮助!

java testing groovy intellij-idea

3
推荐指数
1
解决办法
2216
查看次数

标签 统计

groovy ×1

intellij-idea ×1

java ×1

testing ×1