What is Unit Testing in Software Engineering

What is Unit Testing in Software Engineering

Unit Testing In Software Testing:

  • Unit testing in software engineering is the smallest testable piece of software. It means testing a subprogram/module and checking is possible only by the programmer.
  • Method Used for unit testing: White Box Testing
  • Unit testing is done by developers.

When Unit testing should be done?

  • Testing can happen anytime when a basic unit of code is ready
  • Unit testing should be done before Integration testing.

By whom unit testing should be done?

  • Unit testing will be done by the developers and testers (if required).

Unit Testing Techniques:

White Box Testing Techniques/The way in which Unit Testing is performed :

  • Statement Coverage – This technique is aimed at exercising all programming statements with minimal tests.
  • Branch Coverage – This technique is running a series of tests to ensure that all branches are tested at least once.
  • Path Coverage – This technique corresponds to testing all possible paths which means that each statement and branch is covered.

Unit testing tools available in the market, are as follows:

  • NUnit
  • JUnit
  • PHPunit
  • Parasoft Jtest
  • EMMA

How to achieve the best result via Unit testing?

  • Naming conventions for unit test cases must be clear and consistent.
  • Identified bugs on unit testing must be fixed before the next level of SDLC
  • Only one code should be tested at one time.
  • If there are changes in the code of any module, ensure the unit test is available or not for that module.

Advantages and Disadvantages Of Unit Testing in Software Engineering

Advantages of Unit Testing in Software Engineering

  • Unit testing uses a module approach due to any part can be tested without waiting for the completion of another parts testing.
  • The developing team focuses on the functionality of the unit.
  • Refactoring of code can be possible after a number of days by the dev and ensure the module is still working without any defect.

Disadvantages of Unit Testing in Software Engineering

  • It cannot identify integration  error
  • Some Code knowledge required
Other Popular Articles

What Are The Software Testing Methods

Leave a Comment