To Mock or Not to Mock

Not sure if I'm using Mock or Stub

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:

Mock Or Not 

PDF
To Mock or Not To Mock?An Empirical Study on Mocking Practices Delft University of Technology Software Improvement Group: Davide Spadini, Maurício Aniche, Magiel Bruntink, Alberto Bacchelli 

To mock, or not to mock, that is the question by Alex Kondrashov

Testing Basics: SUT and DOCs

The Difference Between Mocks and Stubs 

SNAC

SNAC Social Networks Are Crap

How to run your own social network (with Snac)

May be distracted for a bit...I should really push these changes first...


Comments

Popular posts from this blog

Can KDE Save a Dying Windows Platform?

Died in a Blogging Accident

Windows Platform Death Revisited