2016-07-14 160 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