Uncle Bob's three rules of test-driven development state the following:
- You are not allowed to write any production code unless it is to make a failing unit test pass.
- You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
- You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
Some people argue that the second rule implies that you must only ever add one failing test (an example of an isolated behavior). But others argue that it could also mean you may add multiple failing tests in a test suite, as long as you stop working on each separate test as soon as it fails.
I would like to know what advantages you get from limiting yourself to writing only one single new failing test and then stop writing test code until you made it pass.
You are not allowed to write any more of a unit test than is sufficient to fail
might imply that a test did not fail at some point. After all, one character might trigger a syntax error that causes compilation to fail. I am talking about writing a test, execute it to verify that it fails, then repeat this process for a few more tests. And only then, you start implementing. The question would be if the described practise is somehow inferior to writing a failing test and then instantly make it pass and only then start writing another failing test.