2011-10-08 65 views
0

閱讀Grails的單元測試文檔我碰上了以下內容:Grails單元測試中不包含哪些動態方法?

Grails中,你需要特別瞭解 單元測試和集成測試的區別,因爲在單元測試Grails的不注射 任何的在集成測試期間在 運行時期間存在動態方法。

^Grails 9.1 Unit Testing Documenation

而與此我假設失蹤注射方法是指:

  • getBy*.save()從GORM方法和Hibernate

有什麼其他動態注入,他們在這裏談論?

回答

5

基本上所有與GORM相關的方法(動態查找器等)都是文檔中指出的內容。它們不適用於單元測試(沒有模擬),只能在集成測試中使用。

以下是在單元測試過程中不可用的大多數方法。

addTo attach count countBy createCriteria delete discard executeQuery executeUpdate exists find findAll findAllBy findAllWhere findBy findWhere get getAll getDirtyPropertyNames getPersistentValues ident isAttached isDirty list listOrderBy load lock merge read refresh removeFrom save