Unit Testing

Unit Testing chart

In the field of software testing, the term 'Unit' depicts the smallest component of the software product, which can be tested, using the testing techniques. It is the smallest testable part of the software or system, which is capable of accepting and producing input and output, respectively. These units are integrated, to form the modules or the system.

What is Unit Testing?

It simply, refers to testing the smallest component/unit of the software. It is the process of testing the each individual unit of the software product, independently in isolation.

Unit Testing is, basically the first level of testing, which is performed to evaluate the working of each unit, before integrating them to form the system. It verifies and validates the each unit, on the basis of specified requirement, so as to integrate them and perform further testing on it.

Unit Testing chart

Necessity of Unit Testing

It is an effective testing, which may prove to be economical for the software development process, as detecting the defects in the integrated system is much more complicated, whereas it is easier to find the bugs & defects in the smaller units. Early detection of the bugs in the software development process enables the developer to fix them, at the initial stage of the development process, thereby saving both time & cost of the project.

Unit Testing Strategy:

It uses the basic strategy to carry out the process of testing the software's unit. The strategy follows by unit testing, usually consists of following activities

  • Defining and creating Unit Test Plans.
  • Based on the specified test plans, unit test cases are designed and prepared.
  • Execution of these test cases on each individual unit.
  • Fix the bugs (if any found) and re-evaluate the unit.
  • The cycle of testing keeps on repeating, until the unit gets rid of all the bugs.

Key Points about Unit Testing

  • Evaluates each individual unit of the software product, independently.
  • Also known by the name of component testing, it is the starting level of the testing, which is performed prior to the integration testing.
  • Generally, it is carried out by the developer, as it will be easier to trace and remove the bugs & defects in its own developed programming code. But, there is also a disadvantage associated with it. Every parent does not perceive any defect or bad thing in their child/children unless the child performs any undesirable or unexpected work(in the -ve sense). Similarly, the developer's mind may also creates a perspective of having no error in its programming code, unless the code outputs some unexpected results that were not desired by the developer. Morever, in exceptional cases, this type of testing may also be assigned to professional testers.
  • It may include testing techniques like walk-through, review & inspection of programming code. In addition, this type of testing also demands strict possible test plans for each isolated units, to produce effective results.
  • Automated testing is preferred for this type of testing. However, manual testing may also be approached.
  • Requires plenty of time & patience to focus & perform testing on each unit.
  • Provides an effective approach to trace & resolve the errors in the programming code at an earlier stage and thereby saves time & cost of finding & resolving the error, at later complex stage.

Get the detailed information of unit testing frameworks here.