daily-email: add 2023-10-01

TDD: repeat and refactor
This commit is contained in:
Oliver Davies 2023-10-04 22:01:01 +01:00
parent 1104aa1cf8
commit 91cee4f384

View file

@ -1,10 +1,26 @@
---
title: >
Development feature flags vs. product feature flags
TDD: repeat and refactor
pubDate: 2023-10-01
permalink: >
archive/2023/10/01/development-feature-flags-vs--product-feature-flags
# tags:
# - a
# - b
archive/2023/10/01/tdd--repeat-and-refactor
tags:
- automated-testing
- software-development
- test-driven-development
- refactoring
---
With test-driven development, you start with a failing test and focus on getting it to pass.
But what do you do once it's passing?
You either repeat the process, adding more assertions to the same test until you generate the next failure or write the next failing test, or take the opportunity to refactor the code.
Is there something you'd like to change within the implementation or test code? You can do that whilst the tests are passing.
You may want to extract a new class or method to improve the implementation or create some test helpers to reduce duplication within the tests.
You just need to keep the tests passing to ensure the code still works. If something breaks, you fix it as soon as possible, either by fixing the code or reverting to the previously passing code.
Then, once you've completed the refactoring, move back into the red/green phase with the next test failure.