docs(daily-email): add 2022-11-19

This commit is contained in:
Oliver Davies 2022-11-23 07:52:49 +00:00
parent 93b0d7a8af
commit f3946dbd21

View file

@ -0,0 +1,17 @@
---
title: >
Are missing tests a blocker to refactoring?
pubDate: 2022-11-19
permalink: >
archive/2022/11/19/are-missing-tests-a-blocker-to-refactoring
---
Is having automated tests a prerequisite for refactoring a piece of code?
Without passing tests for that code, any changes made could introduce a regression, and bugs can be accidentally introduced.
When refactoring with tests, you run them before making any changes to ensure they pass. The tests are rerun after every change to ensure that they still pass and that the change didn't introduce a regression that caused the test to fail. If a test fails, the change is reverted and re-attempted.
If I need to refactor some code without tests, the first thing that I'll do is add some initial tests before the main work.
Whilst nothing is stopping me from refactoring without the tests, the risk isn't something that I'd want to take on, and I'd much prefer to have some tests in place - just in case!