First let me just state that coding without unit testing is just plain crazy. Without unit tests I'm living in constant fear of breaking something without noticing. So I'm all for unit testing, and I prefer doing it using TDD.
My question however is; when should you introduce unit tests when starting a new project? Living in the spirit of TDD the first code line of the project should probably be a unit test. However, no matter how much I love that fuzzy feeling TDD gives I often find it difficult to start out with unit testing from the beginning when you have nothing. Often I find it easier to "cheat" and code without testing from the beginning, and introduce tests when I see where the project is going.
What are peoples opinions on this? When should I introduce unit tests when starting new projects?
You should be able to start with a unit test. If you find it difficult to do so, then you probably haven't broken down the requirements to their atomic bits well enough, at least in my experience.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With