Move daily emails into the blog page
This commit is contained in:
parent
be69398931
commit
1b8441608f
828 changed files with 9 additions and 196 deletions
26
source/_posts/2023-09-09.md
Normal file
26
source/_posts/2023-09-09.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: >
|
||||
A lack of tests discourages refactoring
|
||||
pubDate: 2023-09-09
|
||||
permalink: >-
|
||||
daily/2023/09/09/a-lack-of-tests-discourages-refactoring
|
||||
tags:
|
||||
- automated-testing
|
||||
- test-driven-development
|
||||
- refactoring
|
||||
- software-development
|
||||
---
|
||||
|
||||
A common cause of not refactoring code is a lack of test coverage.
|
||||
|
||||
Why change some code if it works? What if we break it whilst refactoring it and introduce a regression?
|
||||
|
||||
If the code has accompanying automated tests, this can't happen.
|
||||
|
||||
The tests should be passing before starting a refactor and should be passing once the refactor is complete.
|
||||
|
||||
If the tests fail, the refactor was unsuccessful and should be reverted.
|
||||
|
||||
If you have a CI pipeline, a failing test should break the pipeline and prevent any further steps if you're doing continuous delivery or deployment whilst signalling to the Developer their refactor was unsuccessful and the pipeline needs to be fixed.
|
||||
|
||||
Without tests, the code could be broken during the refactor, and we wouldn't know.
|
Loading…
Add table
Add a link
Reference in a new issue