Martin Fowler suggested that the way to deal with complex external dependencies in tests is to create a recording test double. This double can run either as a proxy that calls the real implementation, or as a mock that returns stored values.
When run in recording mode it:
Records the calls made and writes them out as fixtures.
Return the real results.
When run in playback mode it:
Returns the results from fixtures store on disk.
This gives us both the ability to run against real Redis or Riak when needed, but also the ability to be independent of Redis or RIak hiccups and changes and to have faster tests.
Martin Fowler suggested that the way to deal with complex external dependencies in tests is to create a recording test double. This double can run either as a proxy that calls the real implementation, or as a mock that returns stored values.
When run in recording mode it:
When run in playback mode it:
This gives us both the ability to run against real Redis or Riak when needed, but also the ability to be independent of Redis or RIak hiccups and changes and to have faster tests.