Software development doesn't involve only actively writing code. We also write code to test our code.
This article will introduce you to three types of software testing developers do as part of their jobs.
Unit Testing is probably the most popular form of software testing among developers.
What is Unit Testing?
Unit Testing consists of testing a small and isolated piece of software code.
Usually, it's good practice to test only public methods.
Developers do unit testing to test what is visible rather than the internal details of the application.
The general recommendation is that developers should only test the main behaviours of the application rather than implementation details.
What's the purpose of unit testing?
The purpose of unit testing is to allow developers to identify as many problems as possible at an early stage.
Integration Testing consists of testing if all units work together.
Developers use integration testing to ensure that all integration points work well together and that each system interacts with the other correctly.
Why do we need integration tests?
We need integration tests because:
Software has many different modules programmed by different developers, and we want to check that the logic works as expected, regardless of who implemented it.
Software code interacts with external APIs, and integration tests are helpful to ensure that we return the expected response and that data passed is accurate.
Change of requirements: often, changes in requirements are not tested, and integration tests help in these scenarios to ensure that all changes are included in the application.
When developers bring in new changes, there's always the chance to break the existing application.
Regression testing is a type of testing used to ensure that all the existing functionalities of a software application work fine.
The main goal of regression testing is to detect bugs that developers may have introduced unintentionally after a new change.
In Agile methodology, developers should do regression in every Sprint to ensure that all the previous functionalities developed until the previous Sprints work fine.
Regression testing is somewhat different from the other types of testing because it's not based on any programming languages such as Java, C#, etc. Developers can run regression tests separately from the codebase.
Regression testing is done on the product to ensure no new issues with the added functionalities.
Why is regression testing necessary?
Here's an example:
In January 2012 UK retailer Marks and Spencer accidentally priced TVs at £199 instead of the £1099 that they should have been listed for. Regression test scripts should have been written to check the price against the database, resulting in simple bug fixes rather than potential losses.
What is Regression Testing? | Methods & Benefits
This article has given you a brief overview of the software testing developers do.
These are only some of the types of software testing. The choice of testing depends significantly on the company and type of product.
Which one of these do you do as a developer?
Let me know in the comments.
Until next time! 🙋🏾♀️