To Mock or Not to Mock
Applications depend on data to function, and in the modern world that data is usually stored somewhere up in the nebulous concept known as the "cloud" but is actually a computer processing your requests and spitting back data.
During the development of an application decisions about how to supply the required data and service those requests for more must be made.
Here is a non-exhaustive list of options:
Real live production Actual Data.
That poor lil computer in the cloud did nothing to deserve being pummeled with malformed and/or repeated requests for the same data during live testing. Let alone tortured with automated testing on every commit. Be a considerate developer.
Local Representative fake Data
This is a good starting point. It has the unfortunate side effect of having to be manually updated, maintained, and carefully constructed with every edge case.
Local Cached data captured from live session.
Few downsides, requires vigilant maintenance and api level checks and a recording & playback system. This approach facilitated testing. Diagnosing random and transient bugs better than even the most verbose logging can achieve. Big fan.
Fake live data (Mock)
This approach gives the developer complete control over the testing environment. This is the most labor intensive. Where in the developer builds, buys or acquires some sort of Mock Server that responds appropriately as the original data source would.
Real Live Fake Data
Run a production (or as close to it) actual server with limited users, access, data and datastore available to CI and included as local app in build tree for developer to test/offline. Also sometimes known as Docker solution. But in this case I'd rather have a build-able piece of source code.
Going to stop right there because that is where this developer landed for this application.
I need interactive data & I need it be local to run testing before going to CI. The organization needs to deploy its own server but if they did I still wouldn't want to hammer it.
Thing is, if you ship a client with a tiny server isn't complete decentralization a few commits away???
Links and references:
To mock, or not to mock, that is the question by Alex Kondrashov
The Difference Between Mocks and Stubs
SNAC
How to run your own social network (with Snac)
May be distracted for a bit...I should really push these changes first...
Comments