开发者

unit testing action classes

开发者 https://www.devze.com 2023-01-27 23:44 出处:网络
H开发者_运维知识库ow to unit test action classes ? frmework like mock runner allows to test action class. But say action class is calling service class and service class in turn calls dao class..How t

H开发者_运维知识库ow to unit test action classes ? frmework like mock runner allows to test action class. But say action class is calling service class and service class in turn calls dao class..How to resolve this issue ?


You need to stub/mock your service classes that are used by your action class. Let's say you have some action class that parses the input, chooses appropriate service, makes a call and give you some answer. So all you need to do is to create some dummy-service, inject it into your action object and do the tests. Mocking frameworks are to help you with creating those dummy services.

0

精彩评论

暂无评论...
验证码 换一张
取 消