无法从命令行运行单个测试规范

时间:2016-07-14 20:36:08

标签: grails gradle

发布时

grails test-app PostIntegrationSpec

从命令行,我收到以下错误:

:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [PostIntegrationSpec]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.115 secs 
| Tests FAILED Test execution failed

测试在那里,如果我这样做,它们会成功运行从IntelliJ通过JUnit运行它们。此外,grails test-app -integration工作正常。我认为gradle可能有问题,但现在无法找到问题。也许错误的插件?

我正在使用开箱即用的grails create-app配置并且

| Grails Version: 3.1.9
| Groovy Version: 2.4.7
| JVM Version: 1.8.0_25

2 个答案:

答案 0 :(得分:3)

一种方法......

./gradlew iT --tests *PostIntegration*

答案 1 :(得分:0)

从命令行运行测试时需要包含该包:

grails test-app com.example.PostIntegrationSpec