3 ms·
> “Before we can add tests, we need to refactor.” - “No.” - “Refactoring th–” - “No.” - “Refa–” - “No.” What to do instead: Instead of “refactoring” without te
by xg15 2y ago
> “Before we can add tests, we need to refactor.” - “No.” - “Refactoring th–” - “No.” - “Refa–” - “No.”
What to do instead: Instead of “refactoring” without tests, we can start by writing some tests! Writing new tests will help us learn about the code. After that, we can come back to refactoring.
I assume the author means system tests here? Because it's absolutely possible to have code that is so entangled that it's impossible to write self-contained unit tests before, well, refactoring the code.
- zingar 2y agoI mean tests of any kind. The main reason I see for tests not existing is because the engineers don't have the skill to write effective tests fast enough (and after a while in that state, just deciding that tests aren't worth it). The code not being testable is a distant second or third.