mardi 28 juin 2016

partial mock for class

I am using OCMock to do unit test. I know there is a function from OCMock which can partially mock an object. I mean this one:

[OCMockObject partialMockForObject:anObject]

But, I have a class which only consists class functions. E.g. MyHelperClazz class, I only use it like [MyHelperClazz helperFunc].

I need to mock some functions in MyHelperClazz, but for others I want my test code to run real implementation of MyHelperClazz. So, I need to partial mock it. But it is a class not a object.

How can I partially mock a class with OCMock? If it is impossible, how to achieve my goal?

Aucun commentaire:

Enregistrer un commentaire