Component Testing is a process in which each component of the software application is tested for defects and failures separately. For example, if in an application, there are five major components or modules, then in component testing each of these five components are tested individually and separately. This is usually done after the Integration Testing is done.
Given below are a few important points that will help you understand the concept of component testing better
- Component testing is also popularly known as module or program testing; in this process, defects in the module or component are detected and correct functioning of the software is verified
- Unlike unit testing, which is done by the developer to test their own pieces of code, component testing is fully done by a tester
- Component Testing may take place in isolation from the rest of the system depending on which software development lifecycle model has been chosen for that particular project; in such cases, the missing parts of the software are recreated in a simple manner using stubs and drivers to simulate the functional interface between the software components under test
- Let us consider an example to understand this well. Suppose there is an application which has three major modules, module A, module B and module C. Now, if module B has been developed before module A and module C, it needs to be tested. But, the other two modules are not yet complete and few of the functionalities of module B depend on both module A and module C. In this case, in order to test module B properly, module A and module C are replaced by stubs and drivers to simulate a functional interface for module B
- Stubs are basically used to simulate the functionality of components on which a component undergoing test depends on, these act as responders to calls made during the test and usually do not respond to anything that is programmed outside the test
- Drivers are usually a little more complex than subs. These act as a temporary replacement for calling modules and give the same output as the actual product. These are also used when a software application needs to interact with an external system
After developers test the individual pieces of the code written by them in unit testing, component testing comes into play and is completely done by testers, usually in isolation from the rest of the system.
Component testing is a major part of software testing and plays an important role in finding bugs, defects and failures. It is always recommended to do the component testing before proceeding with the integration testing to make sure that each component of the software application is working as intended.