What is Component Testing?
Component testing is one of the testing technique in which the testing is performed on each individual component separately without integrating with other components. It's also referred to as Module Testing when it is viewed from an architecture perspective.
Generally, any software as a whole is made of several components. Component Testing deals with testing these components individually.
It's one of most frequent black box testing types which is performed by QA Team.
As per the below diagram, there will be a test strategy and test plan for component testing. Where each and every part of the software or application is considered individually. For each of this component a test scenario will be defined, which will be further brought down into a High Level Test Cases -> Low Level detailed Test Cases with Prerequisites.
The usage of the term "Component Testing" varies from domain to domain and organization to organization.
The most common reason for different perception of Component testing are
- Type of Development Life Cycle Model Chosen
- Complexity of the software or application under test
- Testing with or without isolation from rest of other component in software or application.
As we know Software Test Life Cycle Architecture has lots many test-artifacts (Documents made, used during testing activities). Among many tests – artifacts, it's the Test Policy & Test Strategy which defines the types of testing, depth of testing to be performed in a given project.
Who does Component testing
Component testing is performed by testers. 'Unit testing' is performed by the developers where they do the testing of the individual functionality or procedure. After unit testing is performed, the next testing is component testing. Component testing is done by the testers.
When to perform Component testing
Component testing is performed soon after the unit testing is done by the developers and the build is released for the testing team. This build is referred as UT build (Unit Testing Build). Major functionality of all the components are tested in this phase,
Entry criteria for component testing
- Minimum number of the component to be included in the UT should be developed & unit tested.
Exit criteria for component testing
- The functionality of all the component should be working fine.
- There should not presence of any Critical or High or Medium severity & priority defects defect log.
Component Testing Test Strategy
Based on depth of testing levels, Component testing can be categorized as
- CTIS - Component Testing In Small
- CTIL - Component Testing In Large
CTIS – Component Testing in Small
Component testing may be done with or without isolation of rest of other components in the software or application under test. If it's performed with the isolation of other component, then it's referred as Component Testing in Small.
Example1: Consider a website which has 5 different web pages then testing each webpage separately & with the isolation of other components is referred as Component testing in Small.
Example2: Consider the home page of the guru99.com website which has many components like
Home, Testing, SAP, Web, Must Learn!, Big Data, Live Projects, Blog and etc.
Similarly, any software is made of many components and also, every component will have its own subcomponents. Testing each modules mentioned in example 2 separately without considering integration with other components is referred as Component Testing in Small.
Click on Testing Drop Down menu as per the below snap show and see various "subcomponents" of Testing component. So the sub-components displayed are Manual Testing, SOAPUI, QTP, JUnit, Selenium, Test Management, Selenium, Mobile Testing, etc.
Note: The sub-component are mentioned with red highlighted color in the below snapshot.
CTIS – Component Testing in Large
Component testing done without isolation of other components in the software or application under test is referred as Component Testing Large.
Let's take an example to understand it in a better way. Suppose there is an application consisting of three components say Component A, Component B, and Component C.
The developer has developed the component B and wants it tested. But in order to completely test the component B, few of its functionalities are dependent on component A and few on component C.
Functionality Flow: A -> B -> C which means there is a dependency to B from both A & C, as per the diagram stub is the called function, and the driver is the calling function.
But the component A and component C has not been developed yet. In that case, to test the component B completely, we can replace the component A and component C by stub and drivers as required. So basically, component A & C are replaced by stub & driver's which acts as a dummy object till they are actually developed.
- Stub: A stub is called from the software component to be tested as shown in the diagram below 'Stub' is called by Component A.
- Driver: A driver calls the component to be tested as shown in the diagram below 'Component B' is called by Driver.
Sample Test Cases for Component Testing
Consider 2 webpages as per the diagrams mentioned below, Here both the web page are interrelated to each other from a functionality point of view.
- Web page 1 is login page to demo.guru99.com
When the user entered valid user-id and password in the text field and click on submit button, the web page will be navigating to the home page of guru99 demo bank website.
- Web page 2 is home page of Guru99.com
So here login page is one component, and the home page is another. Now testing the functionality of individual pages separately is called component testing.
Component testing scenario's on web page1 –
- Enter invalid user id and verify if any user-friendly warning pop up is shown to the end user.
- Enter invalid user id and password and click on 'reset' and verify if the data entered in the text fields user-id and password are cleared out.
- Enter the valid user name and password and click on 'Login' button.
Component testing scenario's on web page2 –
- Verify if the "Welcome to manager page of guru99 bank" message is being displayed on the home page.
- Verify if all the link on the left side of the web page are clickable.
- Verify if the manager id is being displayed in the center of the home page.
- Verify the presence of the 3 different images on the home page as per the diagram.
Unit Testing Vs Component Testing
Component testing plays a crucial role in finding the bugs. Before we start with the integration testing, it's always recommended to perform the component testing in order to ensure that each component of an application is working effectively.
Integration testing is followed by the component testing. Component testing also referred as module testing in some references.