Ada*_*dam 3 java testing groovy intellij-idea
我正在尝试使用 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)
将不胜感激任何帮助!
解决方案:
通过将以下行添加到 build.gradle 解决了这个问题:
test {
useJUnitPlatform()
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2216 次 |
| 最近记录: |