Why shouldn’t we miss writing unit tests?

Recently I started writing unit tests for all the code I am writing. Well,this is not a special practice.

It might sound stupid,but the real reason for which I started to write unit tests is to avoid the build time. Every time I added a new piece of code,I wanted to be sure it worked well. Earlier I was in a small project where the build was very quick-almost instantaneous. But now, I am part of a bigger organization,bigger team and bigger project.

We have close to 256 projects in our solution. So every time I write a new method I need to run several dependent projects before I could verify my new method. This used to take several minutes of time. That is when I realized I shouldn’t be waiting for the builds to happen just to test a single method. And the obvious way out was to write unit tests.

I started writing unit tests and running the test instances. I was/am delighted to see the tests running successfully. Writing tests has cut down the time I had to wait for the dependent projects to run first. It has minimized the scope of errors.

Now, I write unit tests as I develop the code. It has helped me to write better code,and it more readable and more testable.Importantly,in huge projects where time is money,writing unit tests saves lot of time in checking how a piece of code works.

It is a very bad feeling to spend extra time in the office just because you want to test the code you have written. To leave the office on time,it is better not to miss writing unit tests. Make your code better by writing unit tests and leave on time!!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.