Transform Your Development with TDD (Test Driven Development)

Shivam Mohan
Nerd For Tech
Published in
5 min readApr 15, 2023

--

Test-Driven Development makes it possible to construct more robust code by revealing previously hidden bugs.

Photo by Markus Spiske on Unsplash

“Write your unit tests before your code,” an adage that every developer knows by heart, in theory, but seldom practices in reality.

Test-Driven Development (TDD) is a novel concept that instructs developers to write unit test cases before writing even a single line of code.

Robert C. Martin, or Uncle Bob, as he is famously known by many, proposed three laws of test-driven development that every developer who practices it (or at least thinks he does) should follow.

Law 1: You are not allowed to write any production code unless it is to make a failing unit test pass.

Law 2: You are not allowed to write any more of a unit test than is sufficient to fail, and compilation failures are failures.

Law 3: You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

In my opinion, these three laws are comprehensive and are a wholesome guide for anybody starting his/her journey with TDD.

--

--