2016-07-14 165 views
1

单独测试Specifictations当在命令行中发出无法运行在命令行

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的创造,应用程序配置和有

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

回答

3

一种方式来做到这一点...

./gradlew iT --tests *PostIntegration* 
+0

谢谢。那为我做了。我想通过 – thomi

+0

@thomi来理解这个问题如果测试在'src/integration-test/groovy'下定义,并且由于某种原因你真的想使用'grails test-app',你可以用'grails test -app -integration PostIntegrationSpec'或'grails test-app -integration PostIntegration'。 –

0

您需要包括包运行时从命令行测试:

grails test-app com.example.PostIntegrationSpec 
+0

谢谢,我试过那个。但是发布的gradle命令似乎有问题 – thomi