December 1, 2020

Why You Should Test Your Applications? Understanding Test Pyramid

Why You Should Test Your Applications? Understanding Test Pyramid

Why Testing is Important?

     If you are going to buy a car, you prefer to buy it from a reputed company rather than a random road side guy. The reason is simple, you believe in quality and trust that the company can deliver it. You know the car underwent many stringent tests before arriving into your garage. Similarly, When you are builiding a software, you should make sure to test it thoroughly before delivering it to the client.

Benifits of Testing:

      No code in this world is 100% bug free. But Testing a software properly before it's release helps in reducing the bugs to a great context. Less bugs means more satisfied customers and  more business.

Writing Tests or going through Tests is a great way to understand a product. If a new teammate joined your project, it is a good way to involve him in a project.

Load Testing or Stress Testing is where you test applications with huge number of requests. This will help to plan infrastructure better and reduce costs.

Cons of Testing:

The only problem in writing tests is ,it often involves time and sometimes due to developer's lack of interest can lead to boredom.

End of the day, We can say confidently that there are no enterprise products with out good testing.

Test Pyramid:

Mike Cohn mentioned first about something called "Test Pyramid" so that companies can better their products in an agile way. However, he broadly specified the elements of pyramid. We are presenting you a modified version which most of the companies are adopting.

Let us understand how these peieces fit.

Unit Testing: Let us think about a car company. Before build a car, all the spare parts like brakes, wheels, steering etc ..will be procured. These spares or let us say units should have gone through stringent quality tests. Similarly, The first level of testing is "Unit Testing" where a developer tests his own code and make sure the code works as expected. A Unit is the smallest testable piece of code. It can be a single function, a class or an api.

Integration Testing:  In this phase, multiple units are integrated and tested. For example, let us consider car manufacturing. There will be different scenarios like how a wheel rotates when a steering turns, how a brake works when applied etc .. In coding world, we write test scenarios without involving UI. For example, testing login functionality when user passes credentials through API.

System Testing: This is a broad term and it involves many types of testing, like  a. functional testing, where the full functionality of an application is tested End to End using UI, b.Load Testing where application is tested under high load.  There are many more types involved.So we use the broader term "System Testing".

Acceptance Testing: This is the phase where a client or end-user thoroughly tests the software before taking to production.

And That's it for the day! Happy Coding !!