DEV Community

Discussion on: Why Testing After Is a Bad Practice

Collapse
 
mbarzeev profile image
Matti Bar-Zeev • Edited

Writing code without having a clear functional spec of what should this code do is hard. Very hard. I need to know what I want the code to do before I jump in and write it. I found that the best way of creating this functional spec is with testing before the code.

Collapse
 
ashleyjsheridan profile image
Ashley Sheridan

How do you begin writing a test for anything if the functional spec of that thing isn't clear?

Personally, I find it easiest to break the business requirements into the smallest unit of work that effectively results in a complete item. Then it becomes pretty simple to break that down across the various code layers as required to ensure an approach that follows clean, SOLID principles. Tests are more easily written for such code.

Thread Thread
 
mbarzeev profile image
Matti Bar-Zeev

How do you begin writing a test for anything if the functional spec of that thing isn't clear?

I don't. Or at least, I strive not to.
I'm saying the same thing, but the flow is test first 🤓