oliverdavies.uk/source/_daily_emails/2023-05-07.md

21 lines
890 B
Markdown

---
title: >
You don't need to think about what to do next
pubDate: 2023-05-07
permalink: >-
archive/2023/05/07/you-dont-need-to-think-about-what-to-do-next
tags:
- automated-testing
- test-driven-development
---
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.