Finaly, here is a blog in support of all those who feel writing unit test cases is a sheer waste of time.. or is it?? Lets see..
Below are few of the reasons:
1.) You are Neo (from The Matrix) , the ‘chosen one’
You can see the code getting executed as green binaries. You feel the code and understand every use case, you are just so rediculously genious that you don’t require any safety net of unit test cases to identify problems; you can see them with your naked eyes!
2.) Your BA / Product Owner is 10th avatar of Lord Krishna
So whatever he tells you is just Absolute truth! There is no confusion, discussion, ambiguity in the stories because those are the words of God! How can you not understand or even question the divine words? Why do you need stupid unit test cases to identify missing use cases, when nothing is missing!
3.) Your team has mastered the ancient art of predicting future.
You have the Oracle in your team, you have forseen all the changes which are going to come in future. You have peeped inside your constumer’s mind !
When you have already taken care of all the changes before hand, then why would your code change ever??
Why would there be any refactoring??
Why would there be any enhancement requests?
You have written the perfect code for present as well as for future, so why should you waste time on writing unit test cases?
Why would you be bothered to know about the impact your change might have on the other modules?
4.) You know that your project will never get into maintenance phase.
Can you tell me how your code would never go into maintenance phase?? Any guesses??
Yeah right, it should never get released..!! You should just continue coding for 2 years without following any principles of agile or testing!
I’m pretty sure that; as a result this project will never go live. Problem solved. No live code.. no maintaince.., no refactoring.. no bug fixing.. no changes.. easy peasy..
(and if it goes live somehow, switch the company )
5.) You are an evil consulting company who makes profit only by maintenance of projects!
Your company has bid for a project with insane timelines and cheap billing rates. They know very well that its an investment to deliver project in almost no profit because the return is gonna come soon!
They know, what will be produced is gonna be crap! And of course it will have no unit test cases at all!
Result : The project will surely be delivered, but to fix its bugs/maintain it, it would take 10 times the effort than what it took to build it! And since you have built it real bad; only you know how to fix it!
And as there are no unit test cases, no one would be able to analyse what would go worng when you change one moving part! Better!! Why? Because then you would have introduced more bugs while fixing the older ones!!! Result ; more billing!!
(muwhahahaa..haahaaa … evil laughter!!)
6.) You know you are not going to be around
You will not be there for long in the project or company to see if the project failed. Best use case : You are serving your notice period! You know you are never going to see the code which you are writing today, its not your responsibility if things go wrong later!
(Make sure you change your email address and phone number after you switch the company, and have taken relieving letter )
7.) Revenge is best served cold!
You have suffered all your life as a programmer trying to fix bugs in legacy code which had no or very minimal unit tests. Half of your life got wasted in identifying what’s happening and the other half trying to fix the mess which your change created!!
You have had it enough!! Now its time for other earthly creatures to suffer in hell the same way you did!! So you don’t write any unit test cases, let the person who will be working on your code later understand your pain and misery!!
And, finally you will be avenged!
8th , 9th and 10th reason, I leave for you guys to figure out, I’m sure you must have hundreds of more excuses not to write Unit Test cases.
In case you dont have these reasons then better start writing Unit Test cases now!!
PS: I wrote 10 reasons just because it sounded cool