From f3946dbd219c4cc1692b430815a72913945cb8cf Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 23 Nov 2022 07:52:49 +0000 Subject: [PATCH] docs(daily-email): add 2022-11-19 --- website/src/daily-emails/2022-11-19.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 website/src/daily-emails/2022-11-19.md diff --git a/website/src/daily-emails/2022-11-19.md b/website/src/daily-emails/2022-11-19.md new file mode 100644 index 00000000..8cc1ff5b --- /dev/null +++ b/website/src/daily-emails/2022-11-19.md @@ -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!