DEV Community

John Mitchell
John Mitchell

Posted on

Tests are a business investment

Tests are a business investment, of tech resources, to create business value.

It's good to study the Testing Pyramid. High level tests are slow and brittle, but connect the low-level code to business features. We can discuss their value with the business. Unit tests are fast and detail oriented -- I write a ton of these. Integration tests are useful to bring multiple modules together and check they work as expected.

In practice I write 1-2 high level tests (generally end to end, sometimes UI, or API/integration tests) to help focus development and have something that the business understands. Integration tests are great to iterate on, so that new code and tests actually work with real APIs correctly.

All tests are valuable. They are a high-level specification of the code. They "smooth the path forward" for the low-level implementation. Tests are not a tax, they are a way to think about the work and ensure it acts exactly as needed, no more.

Tests are not free. However they create a lot of value -- they create (business and tech) confidence that the system is working as expected. Tests assist refactoring, which makes the code much cheaper and easier to work with.

(disclaimer: writing a book about tech feedback loops, e.g. tests)

adapted from

Oldest comments (0)