From 91cee4f384fba700e002f5b1cc29451672486d24 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 4 Oct 2023 22:01:01 +0100 Subject: [PATCH] daily-email: add 2023-10-01 TDD: repeat and refactor --- src/content/daily-email/2023-10-01.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/content/daily-email/2023-10-01.md b/src/content/daily-email/2023-10-01.md index 9302b2606..b21d0a01b 100644 --- a/src/content/daily-email/2023-10-01.md +++ b/src/content/daily-email/2023-10-01.md @@ -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.