Agile Testing Quadrants: Unit and Component testing | David Tzemach

Unit tests are the first level of software testing, where individual units of the software are tested. It is considered “white box” testing. The main purpose is to validate that each unit of the software performs as designed.

A unit is defined as the smallest testable part of the software. Usually, a function/procedure that has one or more inputs generates a single output that developers may use to uncover any syntax, technical or logical problems in the code.

benefits of unit testing

  • Performed by developers - The tests are performed by developers, they have a different state of mind than testers use during the regular testing cycles, which increases the variety of the tests).

  • Automated tests – Unit tests are all automated. Therefore, the tests can be executed on a daily basis to guarantee that the new code does not affect the existing code-base.

  • Simplifies the debugging process - When performing unit tests, the developer examines the functionality of the smallest testable part of the code, therefore it is easy to debug each failure.

  • Increases the confidence in the written code - Unit tests are a great tool for developers to gain confidence in their code. Each code change can be examined quickly and after the engineer already knows the previous testing outcomes. In addition, writing tests and executing them, forces the developers to know the logical structure of the code better.

  • Bugs are found earlier - When using unit tests the team minimizes the number of bugs that must be caught at later stages of the development process. Like the traditional development process, it is useful to find bugs as early as possible.

Limitations of Unit testing

  • Limited test coverage - Unit tests can cover only the functional aspects of the tested code, it cannot provide any indication about other aspects such as user interface, usability etc.

  • The limitation of running complex scenarios - Unit tests are used to test small parts of the code, based on simple input and output. It cannot be used to test complex scenarios, which are tested in other test layers.

  • Test maintenance - When working with methods that frequently change (e.g. complex algorithms) the maintenance of the tests may require a big investment of both time and money.

Component testing overview

Component testing is defined as a testing type in which testing is performed on a specific (isolated) component. In this type of testing, the team uses real testing data (instead of fabricated data generated to execute unit tests) to test the major functions of the component.

To explain this type of testing, let’s imagine that we want to test a web application, and that the component that we will test is the log-in page, which is separated from the other components

  • We will test the page’s performance.

  • We will test both negative and positive inputs.

  • We will test all major functions.

  • We will test the user interface for usability.

  • We will test the user interface for accessibility.