True cost of Testing

Or why unit tests are bogus


Classic units test are ones of many inputs — 0, 1, -1, 324923094, 10 or “”, “Julie”, nil, “asdf”*3000 and as such are brittle, cost inefficient nightmares. The unit test is not valuable, it leaves nothing to chance and is like a humid evening — gross. The world is too random for the unit test to thrive.

Instead engineers are turing to acceptance testing and cross functional tests. In Rails / Rspec these are known feature and controller tests respectively.

If a unit test is the description and the documentation for a function, then feature test is the description and documentation for a unit of user behavior (something the user can do). Likewise the functional test is the description for a unit of developer behavior (an endpoint that a developer can consume).

The act of having an actor breathes life into tests and makes them useful — in the same way that unreleased software has no audience, tests without consumers are a pointless waste of time.

Skipping the testing phase is fine for those that don’t want to release their software. But for those that do: Determine who the consumers are and write tests to please them. If the consumer is an end user then write tests that requires the new functionality into existence (TDD). However, if the consumer is another member of the team, then write tests to require API endpoints into existence.

Testing is not an art and does have to be learned, but when tests become a natural part of the thinking process, much of the struggle will drop away leaving value in its wake. Testing is seen as a waste of time but the real waste is not having a reason to test, with nothing on the line there is noting to loose.

In short, tests are only meaningful to the consumers. It’s best know who that is before you start.

Show your support

Clapping shows how much you appreciated Alopex Pilot’s story.