In this article, we will learn
what is Unit Testing and what is the importance of Unit Testing in any project.
What is Unit Testing??
Unit Testing also is known as a component,
module or program Testing focuses on testing individual components
that can be tested separately without having any dependency on any other
component.
The main purpose of performing
unit testing is that each individual components are working perfectly as
designed. Unit testing is often done in
isolation from the rest of the system, depending on the software development
lifecycle model and the system, which may require mock objects, service
virtualization, harnesses, stubs, and drivers. Unit testing may cover
functionality (e.g., the correctness of calculations, error messages),
non-functional characteristics (e.g., searching for memory leaks, performance or
security issues), and structural properties (e.g., decision testing, orthogonal
arrays).
Importance of Unit Testing
ร Finding defects in the component
ร Preventing defects from escaping to higher test
levels
ร Building confidence in the component’s quality
ร Verifying whether the functional and
non-functional behaviors of the component are as designed and specified
ร Reducing overall risk
Now the obvious question
that comes to our mind was on what basis or documents Unit testing could be
performed:
ร Code
ร Design Document
ร Data model
ร Individual Component specifications
What kind of Issue Can be identified by Unit
Testing??
A typical issue that can be
identified in Unit Testing are:
รผ Incorrect or unexpected system functionality.
รผ Incorrect control and/or data flows within the
system.
รผ Failure of the component to work as described in individual
component specifications.
รผ Incorrect data flow or calculations.
รผ Incorrect error messages.
รผ Incorrect code logic