From e29e8771cc786d31f18608bfd9612981a68fe15b Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 3 Feb 2024 23:55:01 +0000 Subject: [PATCH] Add daily email for 2024-02-02 Automated tests prevent you from adding regressions --- source/_daily_emails/2024-02-02.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 source/_daily_emails/2024-02-02.md diff --git a/source/_daily_emails/2024-02-02.md b/source/_daily_emails/2024-02-02.md new file mode 100644 index 00000000..f4fb2731 --- /dev/null +++ b/source/_daily_emails/2024-02-02.md @@ -0,0 +1,25 @@ +--- +title: Automated tests prevent you from adding regressions +date: 2024-02-02 +permalink: archive/2024/02/02/automated-tests-prevent-you-from-adding-regressions +snippet: | + Having automated tests recently saved me from adding a regression to a project. +tags: + - software-development + - automated-testing + - test-driven-development +--- + +Continuing from [my last few emails]({{site.url}}/archive/2024/01/30/tdd-doesnt-mean-you-know-everything-upfront), as well as adding the new use case more easily and quicker, having automated tests also saved me from adding a regression into the code I was changing. + +I'd written a condition in the query to ensure only results that started with the search term. + +Initially, I removed it, but then the tests failed. + +This reminded me why I'd written the condition that way, and I was able to re-add my fix differently. + +Without the tests, I'd likely have removed it and introduced a regression. + +Whilst fixing a bug, I'd have introduced a different bug. + +My tests saved me from doing that and I was able to rectify it quickly before pushing to CI or the staging environment.