Over the last 13 parts, we have learned the technical side of
React
TDD. You now have enough practice to write tests and implement features on your own.
The workplace is a little different. You may hear, โWho has time to write tests? We're already busy building features!โ Or you may inherit a huge codebase without a single test.
Today we will look beyond the technical details and discuss
strategies for making TDD stick on a real project
.
1. The Costs and Benefits of Writing Tests (J-Curve) ๐
The question I hear most often is, โDoesn't TDD make development take twice as long?โ
The honest answer is that
it does take longer at first
.
Upfront costs
Setting up the test environment, creating mock data, and writing tests all take time.
Long-term benefits
The benefits become apparent as the project grows. You spend far less time tracking down bugs and doing QA, and refactoring becomes much less intimidating.
Think of it as
insurance
. You pay a premium in time each month, but when an accident happens and a bug appears, it can save you a great deal.