

Ask HN: How do you get your team to start unit testing/TDD? - codereview11214


======
rojoca
To get benefits from testing you really need your team to buy into it. In my
experience developers are much more inclined to try things that they had an
active part in suggesting or formulating. It's likely your team has some
experience or knowledge when it comes to testing. Assuming you are the team
leader, talk to them, let them make suggestions, or ask them to look into it
and present their own ideas.

I was taught TDD on the job via pair programming and really enjoyed it that
way.

------
lifeisstillgood
Be the example and the enforcer.

Firstly _you_ need to go through all the code and put in place a usable
testing framework, with stubs as needed, so that you on your machine can run
one assert 1==1 test in say 50% of components (not modules just areas of the
system)

then make sure that there is a means to control code promotion (this can be
social butsimplest way is only one person per component can merge to master
and they must abide by these rules:

1\. No code passes without passing all unit tests 2\. No code passes without
code review

oh and the best example of this is subversion where (forgotten his name)
simply code reviewed every patch for six months till everyone just took code
reviews as the norm

so you will have to do that too

Tl;dr

put in place right now a unit test framework with examples in strategic places
around the codebase

ensure you code review every checkin and refuse to pass those withoutgood
enough tests

