You probably can find the answer from the behavioral science, the
present environment where the developer works on does not demand that. Every developer
knows the benefit of doing testing during development, or the disadvantage of
not doing it. But since it is not giving immediate effect, emotionally there is
no motivation of doing it.
We have to come out with a method to provide immediate
demand for the testing while development happens. Writing production code gives
immediate demand, because that has something to show and that is what the work
required. Can we find a reward mechanism to make the developer write unit test
while or before production code? A review session on the unit test case may be
the answer. That will give the developer an instant reward on doing the unit
test.
Similar type of short term reward should also be developed
for acceptance test and other sort of test.
I started doing TDD just because I want to learn how it is
done. After that, I have never successfully made that into my coding habit. I
am always curious about why, since I am fully aware of the benefit of unit
testing and the disadvantage of not doing it. I think I found the answer when I
come across Dan Ariely’s Predictably Irrational, Revised and Expanded Edition:The Hidden Forces That Shape Our Decisions. After implementing the unit test
case review session, it actually encourage the developers to build unit test
into their coding habit.
No comments:
Post a Comment