The first phase is testing the smallest testing unit developed in the Project. A unit can be defined as an isolated piece of code which can be tested independently.Let us take an example, suppose we have to develop an application for an e-commerce site with following requirement.
- Login into System.
- Home Page is displayed.
- Selecting any product and adding to my cart.
- Paying for the Product.
So In this example,
we can divide the project development into following components or units.
- Login Module.
- Home Page Module.
- Transaction Page.
- View Cart Module.
- Payment Module.
Before discussing on
different testing type. Let us discuss how the development flow takes
place.
- Development team will develop different modules or units of code.
- The modules should be integrated successfully with rest of the modules
- The System developed should be integrated with third party components or existing components.
- The system should work as per requirement document.
As one of the
principle of software testing, defects should be captured as early as possible
in the software development life cycle. Since the first step in testing is
testing the individual module developed. If the individual module has defect,
fixing the same can be painful if captured in later stages of SDLC.Unit testing searches
for defects in the testable unit or module as discussed. We need to focus on
testing the functional features as well as non-functional characteristics.
Let us take the
example of unit testing the login module. A login Page needs to be tested as
shown below.
The functional test
case for the unit will include:
- Error Message on providing invalid username or Password.
- Error Message for minimum and maximum allowed characters.
- On providing successful username/Password, Home Page is displayed.
- Since Home Page is not yet created, we will use stubs and drivers to dummy for home Page.
The
above are examples of functional test cases for components.
.
Component testing also includes non-functional
characteristics including memory leaks, and structural testing for code
coverage. Component testing is done mainly by Developers and is mostly white
box testing specially for verification of non-functional validation. Defects
are fixed as they are found as is mostly development defect uncovered during
dev testing itself.
There are various tools and framework
available for unit testing. Junit, testNG are example of framework available for
unit testing. Another framework is Test Driven Framework, in which test scripts
are prepared before coding. The tests are expected to fail before coding phase.
Once Coding is done, all the unit tests are expected to pass. In case, test
failing post development, code needs to be fixed until all the tests created
for component passed.
Summarizing, all we discussed so far.
Component testing is testing the unit
or component or module as an independent unit.
Component Testing is the first testing
performed in the project.Component testing is performed mainly
by developers.Component testing is more of white box
testing on the code.Different Unit testing frameworks are
available in the project.
Some Excellent reference article for
detailed understanding of Component testing are as follows:
No comments:
Post a Comment