2024-02-03 23:55:01 +00:00
---
title: Automated tests prevent you from adding regressions
date: 2024-02-02
2024-05-20 22:58:27 +00:00
permalink: daily/2024/02/02/automated-tests-prevent-you-from-adding-regressions
2024-02-03 23:55:01 +00:00
snippet: |
2024-09-08 22:09:54 +00:00
Having automated tests recently saved me from adding a regression to a project.
2024-02-03 23:55:01 +00:00
tags:
2024-09-08 22:09:54 +00:00
- software-development
- automated-testing
- test-driven-development
2024-02-03 23:55:01 +00:00
---
2024-12-19 20:26:33 +00:00
Continuing from [my last few emails ]({{site.url}}/daily/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.
2024-02-03 23:55:01 +00:00
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.