Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to introduce unit tests in new projects? [closed]

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?

like image 891
stiank81 Avatar asked Dec 03 '22 06:12

stiank81


1 Answers

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.

like image 137
GWLlosa Avatar answered Mar 03 '23 03:03

GWLlosa