Le 23 avr. 2014 à 15:37, Attila Magyar a écrit : > Hi Christophe, > > I'm not sure I fully understand, are you referring to partial mocking? Where > you have a real object but with some mocked methods? If this is the case, > then no, this is not supported. Some people consider this as a test smell, > and I agree with them. Maybe the object under test is too big/complex/has > multiple responsibilities, and extracting some parts from it could solve the > problem. I haven't seen legitimitate use for partial mocking so far, where > one couldn't solve the problem with redesign/refactoring in a better way. > Until this happens I'd like to skip this feature.
I understand your point of view and I have quite the same ... (I also had the same discussion with Guillaume) ... but sometimes, even in a well-designed class, you may need to test a very small part of this class, and in this case, you need a real object with some mocked methods. It is not crucial because you can test your class as a whole (if well designed, only a few methods are involved) but it prevents to test a smaller part. Then, maybe the work to support a real object with some mocked methods does not worth it. Best regards, Christophe
smime.p7s
Description: S/MIME cryptographic signature