The “Value Add” of Testing

1 minute read

TIL what the true value add of testing is…there is none!

Let me explain - I happened upon this article from Google’s testing blog today while I was looking for clarity on when to write end-to-end (E2E) tests vs. when to just unit test. The post has very strong opinions on the purpose and useful-ness of E2E tests, and the underlying sentiment resonated with me.

“Value” in this instance is defined as direct customer value: something that solves a customer’s problem. Testing does not solve customer problems… testing solves developer problems by letting developers know which parts of the application are not working as expected.

A good test is, therefore, one that helps a developer pinpoint exactly where in the codebase an unexpected behavior is occurring. This allows them to fix the underlying problem faster (the value add step), by zeroing in on the unit of code that caused the test to fail.

A robust unit test suite compliments a goal of faster bug fixes: unit tests are written at the highest level of granularity possible in the codebase, and when they fail a developer knows precisely what failed. E2E tests by definition do not provide this resolution, and when they fail (sometimes randomly) a developer needs to do additional digging to determine root-cause of the failure.

E2E tests have their place, but should be used sparingly in favor of more rigorous testing at the unit level. The goal should be for a testing pyramid[1], not an ice-cream cone[2]!

Related Links:

  • [1]
  • [2]