測試依賴於其他服務的Grails服務的最佳做法是什麼? 默認混入TestFor正確注射服務在測試中,如:具有多種服務的Grails集成測試
@TestFor(TopService)
class TopServiceTests {
@Test
void testMethod() {
service.method()
}
}
但如果我的TopService(服務)的情況下依靠其他服務,如InnerService:
class TopService {
def innerService
}
innerService不會可用,依賴注入似乎不填充此變量。我應該如何繼續?
嘗試在您的測試中擴展'GroovyTestCase'。 –