tirade - [tahy-reyd] "a prolonged outburst of bitter, outspoken denunciation"


May 18, 2009

Dogma or belief



Do you believe, now choose

We started a new project a few days ago and it was agreed that we will do unit testing. One of the guys (who incidentally have done tons of unit testing before) asked that we lay down some rules, like: Every method in the application layer must have at least one positive test.  Or: You are not allowed to check in your code if you do not have 100% code coverage. 


I thought about this and about why it does not sit well with me. So this was my reply:

Unit testing is all about belief, and not about dogma. You should have faith in your test and you should test out of principle. You should write test where they are needed and you should write as many as needed because you believe in their value. When you make these dogmatic rules people end up following the rules and forgetting their beliefs.  You many end up with too few tests because the developer automatically stops after the mandatory two tests even if more tests are needed.  You’ll end up with crappy tests because the developers write “filler” tests to make up the mandatory numbers. But mostly I think that dogma stands in the way of belief, and you want your entire team to belief.

People will go the extra mile and further for something they believe in.  They will constantly find ways to make it better. They will tell others how great it is. They will do everything it their power to make is work, to make a success of it. People that believe in testing will write great tests, tests that are thorough, tests that enable change. If it is about the dogma, people will just follow the rules or find ways around it or write “filler test”.

In my experience belief works and the dogmatic rules only gets made if the belief is already missing. What do you think? Do we need the dogma if we have belief? Is it not better to convert the non-believer that to make more rules?

  1. I agree, the “you will have x tests per method per blah blah blah” rule doesn’t sit well with me at all. You might have 100% code coverage and it will probably mean almost nothing. Which is a waste of time, and leads to false ideas (the code is perfect all the unit tests pass and we have 100% coverage – yeeha!). If your team believes in unit testing they will write proper tests to truly test their code. Now … how to get the them to believe that its worth the effort?

    Comment by Sam — May 18, 2009 @ 11:12 pm

Leave a comment

RSS feed for comments on this post. TrackBack URL

Licensed and Generic products for canadian family pharmacy !&;[ buy maxalt online used to treat erectile dysfunction. Trusted source for Canada pharmacy @*(* medicines online with the best prices. Learn about an online pharmacy works with a drugstore. Every day we collect the prices of medicines in canadian pharmacies )|# buy viagra soft All goods when entering the pharmacy passes the test of "drug quality".