DEV Community


Discussion on: When do you write your tests?

alysivji profile image
Aly Sivji

To me it doesn't really matter when tests are written, as long as code is written with testing in mind. The strict definition of TDD means that tests are written first, but it's not the perfect workflow for creating something from scratch. At least in my experience.

With that said, I do add asserts to my code as I'm working. Mostly to make sure functions don't regress. Once I've figured out how I want to structure what I'm trying to do, I'll go back and add formal tests.