我在Spock中使用Grails + Groovy。在我安装Spock并开始编写单元测试之前,该应用程序一直运行良好。
JVM版本-1.8.0_171 *** Grails版本-3.3.6 *** Groovy版本-2.4.15
依存关系-
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-web-testing-support"
testCompile "org.grails.plugins:geb:1.1.2"
testCompile "org.spockframework:spock-core:1.1-groovy-2.4-rc-2"
testCompile "org.grails:grails-test-mixins:3.3.0.RC1"
我也尝试了IntelliJ(最终)中的“清理”和“使缓存无效/重新启动”。
Build failed with an exception
Initialization Error
unit test code
最佳答案
在我看来是一个版本问题。另外,请使用ControllerUnitTest
特性而不是测试mixin。因此,首先从build.gradle
中删除这些行。
testCompile "org.spockframework:spock-core:1.1-groovy-2.4-rc-2"
testCompile "org.grails:grails-test-mixins:3.3.0.RC1"
然后更新测试以实现
ControllerUnitTest
特征。 Here是一个示例。您还应该检查documentation。
关于java - Grails-Spock-任务 ':test'执行失败-Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51523490/