[英]No tests found for given includes (IntelliJ & Groovy)
I am attempting to run unit tests written in Groovy, using IntelliJ and./gradlew command.我正在尝试使用 IntelliJ 和 ./gradlew 命令运行用 Groovy 编写的单元测试。 Building the project works fine, however the tests do not seem to be found.
构建项目工作正常,但似乎没有找到测试。 Running the tests in IntelliJ throws the following code:
在 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)
No tests in my project are found, below is an example class I created in the project under src -> main -> test -> groovy
directory.在我的项目中没有找到测试,下面是我在
src -> main -> test -> groovy
目录下的项目中创建的示例 class。
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
}
}
Would appreciate any help!将不胜感激任何帮助!
Solution:解决方案:
This was solved by adding the following lines to build.gradle:这通过在 build.gradle 中添加以下行来解决:
test {
useJUnitPlatform()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.