TDD Laws
The practice of Test-Driven Development is easy to understand but only sometimes easy to execute. Besides knowing where to start, we also need to know how. The three laws help us identify this path to start writing our tests.
First Law, You may only write production code once you have written a failing unit test.
Second Law, You may not write more of a unit test than is sufficient to fail, and not compiling is failing. Writing enough unit test code to assert a solution allows us to track down each tiny step toward the final solution.
Third Law, You may not write more production code than is sufficient to pass the currently failing test. Add enough code to make a test pass and nothing more.
TDD Laws are essential for writing more granular tests. None of the laws works in isolation. We need to think about them as a group.