The day is saved, Thanks to Unit Testing

We developers make a living by writing pieces of code every day. We develop a product and deliver it to the customer while it is working fine like what the customer had said. In real world product teams we have more than one developer working on a single codebase with multiple modules. The customer at the end is going to play with your product. Of Course, he will be happy but he will need some additional features added or removed. Web nowadays, is very challenging with new frameworks coming up, new plugins popping out of the box, etc,

Our codes become brittle when there is a need for future enhancements. Here is an example, A and B work on a product. A works on a feature, B works on a different feature. Both of them have to implement mail sending. Both A and B had common requirement for mail sending and they started working by creating a common class named MailSender. The class MailSender has Send() method that sends mails to customers. Mail sending is a small part of their big feature development. B unfortunately had to leave on a vacation for some personal reasons and B1 takes care of B’s task. The customer sends a mail to B1

Hi B1

We would like to add ‘Thank You’ as hyper- link in our email template on mail sending. Please implement it.

Thanks

So Far Happy Customer.

Now B1 adds the link in the common MailSender class. A does not know about the change and the product is going to be delivered to the customer. Just guess what happened, unnecessary link for A’s feature. When this has gone through testing, testers are unhappy on A. Here comes unit testing for the rescue.

Unit testing means a sequence of testing followed by developers before it is given to bug finders. Normally developers write a sequence of test cases to make sure their feature work properly.”

There are several unit testing frameworks available and I will discuss one of them in my another article.