Grails - Spock - 任务 ':test' 执行失败 - Gradle
Grails - Spock - excution failed for task ':test' - Gradle
我正在使用 Grails + groovy 和 Spock。在我安装 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(终极版)中尝试了 "clean" 和 "Invalidate caches / restart"。
Build failed with an exception
Initialization Error
unit test code
我觉得是版本问题。此外,使用 ControllerUnitTest
特征而不是测试混合。因此,从 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。
我正在使用 Grails + groovy 和 Spock。在我安装 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(终极版)中尝试了 "clean" 和 "Invalidate caches / restart"。
Build failed with an exception
Initialization Error
unit test code
我觉得是版本问题。此外,使用 ControllerUnitTest
特征而不是测试混合。因此,从 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。