What is Component Testing? (Techniques, Example Test Cases)

Software TestingAutomation TestingTesting Tools

Component Testing

Component testing is a sub-category of software testing in which each individual component of the software is separately tested without integrating with other components. It is also known as module testing, when viewed from an architecture perspective.

A software, in general, is made up of several components. Component testing addresses these components individually. It is one of the most frequent type of black box testing. It is generally performed by the QA (Quality Assurance) team.

Component testing requires a test strategy and test plan, where we consider each part of the software individually. We define a test scenario for each component, which is further divided into high level test cases, low level detailed test cases with prerequisites.

Unit testing is generally done by developers, while component testing is done by testers. Component testing is done after unit testing is completely performed by the developing team. This build is known as UT (Unit Testing) build. In this phase, the testers test all the major functionalities of the software components.

Entry criteria for component testing: The minimum number of components that are included in the UT must be developed and tested through unit testing.

Exit criteria for component testing: 1) the functionalities of all the components must be working as expected; 2) there should be no critical, high, medium severity and priority defect/bug left in the software

Objective of Component Testing

The primary objective of performing component testing is to check whether the input/output behaviour of the test object or component is working as expected. Component testing ensures that the functionality of the component is working properly and as specified.

  • To reduce risks − Component testing validates each component of the software and helps identify bugs in the software code and fix them.

  • Discover bugs in the component − Component testing helps identify bugs in the source code of the software. Also, it validates control flow, functions, data structure, etc., used in the program.

  • Validate the functional as well as non-functional performance of the component − Component testing ensures that the system design and specifications are performing as expected and specified.

  • To improve quality of the component − Component testing is essential in developing and maintaining confidence in the components; fewer bugs in the additional testing; thus, improving the quality of the software.

  • To prevent bugs from escaping to higher testing levels − Developers identify the coding errors and fix them as early as possible. Thus, it reduce the existence of bugs in the higher levels of testing.

Inputs in Component Testing

The primary inputs to component testing are −

  • Test plan
  • System requirements
  • Component specifications
  • Component implementations

Techniques of Component Testing

There are two techniques of Component Testing −

  • CTIS (Component Testing in Small)
  • CTIL (Component Testing in Large)

CTIS

Component testing can be executed with or without separating the software components. When the testing is performed by isolating other components, it is known as CTIS.

For example, consider a website with five web pages. Thus, evaluating or testing each such web page independently by separating or isolating other components is component testing in small.

Every software has many components, and those components have their own sub-components. Testing each component without integration with other components is called component testing in small.

CTIL

Component testing without separating the software components is known as component testing in large. For example, consider an application consisting of three components – Component A, Component B, and Component C.

The developer who developed Component B wants it tested. However, few functionalities of Component B are dependent on Component A and Component C. Their functionality flow is A->B->C. The called function is referred to as stub, while the calling function as driver.

However, the other two components – A and C are not yet developed. So, to test Component B, we replace Component A and Component C by stub and driver, which will be our dummy object till the two components are actually developed.

Stub is that software component that is to be tested, while Driver is that component that calls the stub, i.e., the component to be tested.

Process of Component Testing

  • Requirement Analysis − In the first stage, we identify user requirements associated with each component.

  • Test Plan − In this stage, we design tests to evaluate the user requirements.

  • Test Specification − In this stage, we identify the test cases needed to be executed and those that can be missed.

  • Test Implementation − In this stage, we identify the tests as per user requirements, to implement the tests.

  • Test Recording − In this stage, we record and review the bugs identified during the previous test implementation stage.

  • Test Verification − In this stage, we verify if the software meets the specifications or not.

  • Completion − After all the above six stages are successfully completed, we enter the last stage of the component testing. Here, we evaluate the results to deliver a quality product.

Example Test Cases of Component Testing

Consider two different web pages, interrelated to each other in terms of their functionality.

  • Web page 1 is login page. When you enter a valid user-id and password in the text field, and click the submit button, the web page will navigate to the home page.

  • Web page 2 is the home page. Here, login is one component and home page is another component. Testing each individual page separately is called component testing.

Scenarios while component testing web page 1

  • Enter an invalid user-id to check if the system pops up and warning to the user.

  • Enter an invalid user-id and password, click on “RESET” and check if the data entered in text fields- UserID and Password, get cleared out or not.

  • Enter a valid user-id and password then, click on the “LOGIN” button.

Scenarios while component testing web page 2

  • Check whether any welcome message is displayed on the home page.

  • Check if the links on the left side of the web page can be clicked or not.

  • Check if the manager id is displayed in the middle of the web page.

Unit Testing Vs Component Testing

The following table highlights the differences between Unit Testing and Component Testing −

Unit TestingComponent Testing
Testing of individual programs, modules to verify that they execute as per the specifications
Testing of each object or component of the software individually with or without isolating other components
Validates design documents
Validates test requirements, and use cases
Performed by developers
Performed by testers
It is performed first
It is performed after the completion of unit testing

Why is Component Testing important?

  • Detailed evaluation − Component testing of each individual component enables the detailed evaluation after all the components have been acquired. We can test for all the possible bugs on real web servers. The same is not possible for Unit testing, where we do not test each unit on live servers.

  • Early Bug Identification − Component testing can be executed at any stage, so we can identify and fix bug sooner. It saves us money, effort and time. It also enables the developing team to test the software components for all the preventable bugs/defects before handing it over to the QA team.

  • Certified Contract − Component testing helps us certify the contract; component testing is reliable. It is the best possible way to validate our module or component, to deliver the software as specified. Also, software can be integrated without any doubt.

Conclusion

Component testing is the exact and the best way we can estimate the functioning of a module or component of a software at any stage of its development. It is cost-saving and also saves unnecessary effort at future stages by eliminating all avoidable bugs.

Component testing is performed after the unit testing is completed. The latter is performed by developers, while the former is performed by testers. Component testing must always be performed before integration testing. Because if the former is accurate, then we can identify even the minor defects during integration testing. Component testing ensures that each component of the software is functioning as expected and as specified.

raja
Updated on 30-Oct-2021 11:28:59

Advertisements