DEV Community

Discussion on: Thoughts About Test Driven Development

Collapse
 
agiesey profile image
AGiesey

Thanks for the article! We don't really have a good smoke testing or UI testing process at my work, so for me, TDD helps to make me feel confident about code I'm pushing to release. It can be really hard, especially setup for tests which run the service layer code. One thing that was helpful for me is that I don't write the whole test first, I start out by writing the function signature with a simple throw NotImplementedException();. THEN I write a test and make sure it runs the function. I go back and fourth in increments not much bigger than this until my function and tests are done. The benefit of this method for me is that I get into a rhythm, I discover edge cases and hidden complexity / considerations early. When I thought that I had to write a whole unit test before starting to write the production code, I would get overwhelmed.