我對使用grails有點新,所以請原諒我,如果這有一個明顯的答案。我一直在閱讀有關如何在創建新控制器時自動創建單元測試的文檔。從我在網上和書本上看到的,控制器測試類名稱在最後附加了「測試」。使用Grails 2.3.1在它創建StoreControllerSpec.groovy 的\測試\單位\目錄下,我有grails如何創建單元測試
@TestFor(StoreController)
class StoreControllerSpec extends Specification {
def setup() {
}
def cleanup() {
}
void testSomething() {
\\ added to see if the test works
controller.index()
assert 'Welcome to the gTunes store!' == response.text
}
}
我遇到的問題是,在運行測試應用程序時,它會嘗試運行單元測試,但什麼都不輸出,並且沒有標記爲失敗?
grails> test-app
| Running without daemon...
| Compiling 1 source files
| Compiling 1 source files.
| Running 1 unit test...
| Completed 0 unit test, 0 failed in 0m 4s
| Tests PASSED - view reports in
遺憾沒有運氣,我改名的類,它也做了同樣的事情 – user2168435