Unit Testing: Testing the Source Code Piece By
Piece
One of the important stages in the software development
life cycle, whether the software is for business or pleasure,
is software testing. The software testing is useful in ensuring
the correctness of all programs and performs all functions in
the manner in which it is expected to do. There are a number of
testing types used for testing the software starting from the
development of the application until it reaches the marketing
phase. Before it is released for production any software has to
undergo series of testing such as black box/ white box/ gray
box testing, unit/ integration/ system/ acceptance testing,
functional/ non-functional testing and verification and
validation. The unit testing indicated above is one of the
important testing types and in this each individual unit of the
application is validated for correct working.
Software consists of many different applications which have
to be tested independently for security, performance,
functionality, usability, reliability, efficiency, portability
and maintainability etc. A unit is the smallest part of the
software application. Each of the modules of the software
comprises of a number of individual units. There are a large
number of such units in the application software. Software
testing can either be done for an individual unit or a group of
units. In case there is a problem in the group testing, the
testing has to be done at unit level. Unit testing is the
method of making sure that each of the individual units is
working properly in isolation. In this, testing is carried out
on the minimal software component or module. They get
integrated once the module testing is completed.
One of the many benefits of unit testing is the ability of
the software programmer to change or improve the way the
computer program is read without affecting the functionality/
performance of the program. Test cases are prepared for all the
functions of the program and this facilitates easy
identification and correction of the problems in case of
changes made. It is possible to test the units first and
eliminate all the bugs that appear during this testing. The
entire integrated program can be tested after debugging all the
unit modules. This makes the process easier, faster and
efficient.
The test report based on unit testing is more or less
similar to a written report on the system. This is very useful
for the programmers because whenever they are interested in
knowing the functionality a unit provides they only have to
look at the documentation provided by the unit tester. Unit
testing comprises of many unit test cases and these are
critical to the unit's ultimate success. The test cases show
characteristics that indicate negative behavior in the software
or inappropriate functions.
Unit testing alone will not be sufficient for software
approval; however, this combined with other testing types will
be very effective. It is not possible to trap all errors in the
software either by software testing or unit testing. Unit
testing is useful in testing the functionality of the unit. It
may not be possible to detect integration or performance
problems during unit testing.
Unit testing can be carried out either manually or through
automated tests. The primary objective of unit testing is to
pinpoint the defects in the software, isolate that unit and
correct it.
|