This post originated from an RSS feed registered with Java Buzz
by Ben Hosking.
Original Post: How to persuade Java developers to unit test
Feed Title: A Funny Java Flavoured Look at the World
Feed URL: http://businesslogs.com/WebLog/RSS.xml
Feed Description: The blog looks at using Java and programming in general as it pops up in life as a Java programmer. It will have links to interesting Java articles and resources. It will also have a lot of SCJP Java 1.5 information and links as I am currently studying
I have been trying to persuade/encourage/bully my fellow developers to start Unit Testing. At the moment I'm not have that much luck because they can't see beyond the fact that they would have to write some unit tests and this to them seems like extra work.
I have tried to tell them it makes you write better code with less dependencies.
I have explained you have more confidence in your code when you catch lots of silly syntax errors and know it passes numerous tests.
You are testing anyway, unit testing is just like all those system.out's you are putting in the code except unit testing means you don't have to read them all
unit testing breaks up the sometimes tedious task of writing code, it's good to see that green bar pop up, it is a small victory every time the bar turns from red to green.
Anyway my arguments were falling on deaf ears (they were too busy finding a bug somewhere in their code, MWAHAHAHAA only joking). I find it a bit scary that they are writing code without testing it, especially when you see I know how many small bugs I find.
Anyway whilst noodling about the Aritima site I found the free chapter links and then I found a free chapter on unit testing called "Pragmatic Unit Testing - in Java with Junit"
perhaps they would listen to the words of a good developer and not my cowboy ramblings, it was worth a shot.
The chapter is pretty useful, it's only 14 pages long so it won't scare them or you off. It goes through what Unit testing is and more importantly it has a section called
"Why I should bother with Unit Testing"
if you are already unit testing then it's worth reading the chapter to just have a look at the excuses for not unit testing which will help you realise why you unit test.
So if you need help persuading your fellow developers to start unit testing get them to read this article it might help