Grails - 如何单元测试addTo * [英] Grails - How to Unit Test addTo*
问题描述
感谢您的帮助。
在Grails中,您需要特殊性
知道单元
和集成测试,因为在
单元测试中,Grails 不会注入任何
在
集成测试和运行时出现的动态方法。
您必须在单元测试
中使用 mockDomain(DomainClassName)
或写入一个集成测试:
当 DomainClassGrailsPlugin
被设置(<$ c $)时,Grails用一些Dynamic方法装饰域对象C> doWithDynamicMethods )。
Is it possible to unit test addTo* functions in Grails ?
thanks for your help.
The documentation says in section 9.1:
In Grails you need to be particularity aware of the difference between unit and integration tests because in unit tests Grails does not inject any of the dynamic methods present during integration tests and at runtime.
You either have to use mockDomain(DomainClassName)
in a unit test
or write an integration test:
Grails decorates domain object with some Dynamic methods when the DomainClassGrailsPlugin
gets setup(doWithDynamicMethods
).
这篇关于Grails - 如何单元测试addTo *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!