Ninja Snacks Tales From the Enterprise

Replacing Mocks with Events in Your Tests


Sometimes our model can't be as pure as the driven snow. Sometimes we have to use a really crappy external model because replacing it outright would be too expensive. Typically we deal with this in our tests with some kind of mocking framework.

Example,we have a use case for 'creating' an item in the ERP system. Of course in real life nothing ever gets 'created.' Instead our inventory items are 'created' upstream in the product development context. Once the product has reached a certain point of development, they are released to manufacturing. They must go into the ERP system which is where purchase orders originate.