Levels of testing: how much to test?

I was recently speaking to someone who wanted to setup testing in a new organization. Here is what I said. I think it captured one essence of testing well, so I wanted to write it down — so I can remember and others will benefit.

  • There are tests at multiple levels for software: unit tests, integration/functional tests, end to end tests
  • Each layer provides additional protection. They have different trade offs. Unit tests are very quick to run. But they won’t catch bugs outside of a unit. End to end tests are very close to realistic use cases. But are slow and generally fragile. So they are expensive to maintain
  • Use the cheap tests liberally and the expensive tests for critical use cases

Originally published at www.floatingpoint.ca.