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.
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.