DEV Community

Discussion on: Explain like I'm five: Is Test Driven Development really that used in most of the programming world?

Collapse
 
meanin profile image
Paweł Ruciński • Edited

Yes it is.

Especially for junior devs. Several times occurred that when I was asking about unit test (also in review) or even TDD approach and one of colleague refuse, it quickly turned out that she/he didn't cover all of story paths.

Fortunately we could prevent this waste of time (and money), only if we use TDD at the right time.

Cover all code paths, check edge cases, validate input and output are good entry point on TDD. You cannot defend yourself against all bugs, but you can dramatically reduce the amount of it.

Of course you can just sit and code, but in my opinion it is good only for small projects and PoC. In any larger solution, when a way to manually test a feature consist of setup whole environment, we should use TDD. First, you are testing in isolation only feature you want to test. Second, you can mock any dependencies you want. Even if you want to test your feature with real dependencies, you are able to write integration test (still using TDD).