I connect to a simple, if idiosyncratic, external service.
I believe that my unit tests should not depend on the availability or implementation of this external service, so I intend to mock it.
I need a layout to receive and return realistic messages and replies - otherwise my tests will not represent the real state of affairs. For example, he must throw the correct errors - and there are at least 7 different ways in which he can fail (between you and me it is not a very well-designed external service). Therefore, with a minimum minimum, I should have a hash of message / response pairs.
Thus, instead of reducing unforeseen circumstances, the mockery again introduced him to another place. In fact, as they say, now I have two problems: I have to be sure that my hash has a fair idea of ββhow the external service behaves. But, of course, the canonical source of which response object X transmits message m, is X itself. Everything else is dangerous and random.
Did I make a wrong turn? How can I eliminate this apparent circularity?
EDIT I clarified that, in my opinion, the problem is in the light of useful comments.
testing mocking
Dave Nolan Feb 17 '09 at 22:51 2009-02-17 22:51
source share