You don't need to think about what to do next

When practising test-driven development, you don’t need to think about what to do next.

If you have a failing test, the objective is to get that test to pass as quickly and simply as possible, and you rely on the error from the failing test to tell you the next step.

It could be a failing assertion, an undefined variable or function, or a yet-to-be-implemented service.

Once you’ve fixed that error, the test will either pass or fail. If it fails, you’ll have a new error and know the next step.

When working in this way, it’s like being on autopilot. You can focus only on fixing each error until the feature or fix is complete and the test is passing.

    Was this useful? Sign up here and get more like this delivered straight to your inbox every day.