3
我有一個大的grails項目分成幾個'就地'插件,以保持好的東西和模塊化。我的一個名爲「核心服務」的插件包含了我所有的域類,並且在抽象測試類(添加模擬域實例等)方面做了一些很好的工作,這些工作由許多單元測試共享。我可以將Grails配置爲在我的插件中查看測試類嗎?
這對單元測試來說也很棒,它也存在於插件中,但我想使用該抽象測試類來在其他grails項目的使用該插件的測試中設置模擬數據。運行測試時,似乎並沒有在類路徑中包含插件的測試類。有沒有一種方法,我可以告訴Grails的,包括他們?:
//this abstract test class is in the core service plugin's test directory. My IDE has no problem with this import
import com.myproject.coreservices.service.AbstractGiftInstanceRelatedUnitTest
//this test class is in the project that uses the plugin
class ClaimGiftControllerTests extends AbstractGiftInstanceRelatedUnitTest {
.. my tests
}
和輸出(非重要部分刪除):
| Error Compilation error compiling [unit] tests: startup failed:
...../test/unit/com/myproject/ClaimGiftControllerTests.groovy: 3: unable to resolve class com.myproject.coreservices.service.AbstractGiftInstanceRelatedUnitTest
@ line 3, column 1.
import com.myproject.coreservices.service.AbstractGiftInstanceRelatedUnitTest
^
是的,我最終這樣做了。我會給你答案的答案。它只是感覺錯誤:-) – Peter