Component Testing

Component Testing

Last updated on

Needless to say, software testing plays a crucial role in the software development life cycle (SDLC). To assess the quality, functionality, reliability, usability, and performance of a software product under development, the testing team performs different types of software testing. Among all, component testing is one. 

A software product is made of different modules or components. Each component or module has its own function and performs a certain task or a set of tasks. Several components or modules are combined to form a fully-functional software system. This is nothing but modularity in software engineering. It involves dividing the system into manageable chunks that can be developed and tested individually. 

However, testing these individual components before integrating them is essential to validate their correctness. This is where component testing comes into play. 

This blog post enlightens you on component testing, its importance, types, and the process to perform it with an example. 

What is Component Testing?

Component testing is a type of software testing that involves testing each component of a software product individually. It validates the functionality and usability of each component before integrating it with others to form a complete software product. 

We refer to component testing as module testing. It makes it easier to determine which software component results in errors or bugs. Additionally, it verifies the behavior and functionality of individual components.

Why is it Important? 

Here are some reasons stating the importance of module testing: 

  • This testing type uncovers issues at the module level. It detects possible errors in each software module at an early stage of development. This, indeed, reduces the effort required to validate the entire system during the testing process. 
  • It eliminates errors at the component level. Organizations can significantly reduce the cost required to address these component-level issues in the later stages of development. 
  • It provides confidence to the development team to integrate the components and continue with the next testing type, integration testing.

Goals of Component Testing 

The following are the major goals of component testing: 

  • Uncovering Bugs in a Component: It detects all possible errors in every module of software under development. 
  • Mitigating Risks: This testing type validates every component for its correctness and functionality. In case of any errors or bugs, the development team addresses them immediately before moving to the next testing phase. Hence, module testing mitigates the possibility of risks at the component level. 
  • Improving a Component’s Quality: Uncovering eros or bugs and addressing them immediately improves the quality of individual components. 
  • Avoiding Defects to Escape to the Next Level of Testing: Defects identified in component testing are not passed to the higher level of testing.

Who Conducts Component Testing?

Generally, testers perform component testing after unit testing and before integration testing. After developers conduct unit testing on each component, they release a build called the UT (Unit Testing) build for the QA team to do component testing. Hence, the entry criteria for component testing is the completion of unit testing. 

Let us understand this with an example. 

Consider a project of website development.

  • Initially, the development team will perform unit testing after developing all web pages. 
  • It will further release the build for the testing team to validate the website’s components. 
  • The testing team will verify each component, report errors or bugs (if any) to the development team, and the development team will fix them. 

Here, it is optional for the development team to create all web pages at once before allowing the testing team to validate.

Entry Criteria 

  • All the components of a product should be unit tested. 

Exit Criteria 

  • Each component should be functionally correct. 
  • There should be no bugs or errors of high or medium severity or priority.

Advertisement

Types of Component Testing

Typically, there are two types of component testing depending on the complexity – 

Component Testing in Small (CTIS)

When the testing team assesses a specific component in isolation without any dependency on other components of the software product, it is called component testing in small (CTIS). It is ideal for smaller applications. 

Example – Let us understand CTIS with a real-world example. Consider that you work at a medical device manufacturing company producing insulin pumps. An insulin pump consists of various components, such as a control unit, motor, battery, etc. 

Component testing in small (CTIS) requires you to test each component in isolation to ensure its quality, reliability, and functionality. 

This way, it becomes possible to detect issues before integrating components, reduce potential risks, and improve the overall quality of the pump.

Component Testing in Large (CTIL)

When the testing team validates a specific component with the help of other components of the product, it is referred to as component testing in large (CTIL). The testing of each component requires the input or output of other components.

Example – Let us take a real-world example to understand CTIL clearly. Consider a social media analytics platform consisting of three components –

  • Data Collection: Collects data from various social media platforms, such as Twitter, Facebook, Instagram, etc. 
  • Data Processing: Processes data collected from various sources and applies various algorithms for sentiment analysis, trend detection, and user profiling. 
  • Data Visualization: Generates the visual report from the processed data, analyzes it, and generates valuable insights.

Now, the development team developed the Data Processing component and wants it to get tested. However, this component has a few dependencies on Data Collection and Data Visualization components, which are not yet developed.

The functionality flow is Data Collection → Data Processing → Data Visualization.

To test the Data Processing component, there is a need for the following two components –   

  • Driver: It is a dummy code that simulates the behavior of missing components. It is used to invoke the testing of low-level components. A driver is a higher-level module that called a function to the lower-level module when the calling function is not available.
  • Stub: It is a dummy code that simulates the behavior of missing components. It is used to invoke the testing of high-level components. A stub is a lower-level module and calling function. It accepts input from higher-level modules and returns the corresponding output.

In our example, where we need to test the Data Processing component, the dependent components Data Collection and Data Visualization are not deployed. In such a scenario, we can replace Data Collection and Data Visualization with stubs and drivers as required.

Component Testing Process 

Here is the process of component testing: 

  1. Requirements Analysis: The first step is to analyze the requirements associated with each software product component. 
  2. Test Planning: Based on the requirements analysis, the entire test plan or strategy is outlined. Test scenarios and test cases are created. 
  3. Test Specification: This stage involves determining which test cases to perform on which module and which ones to skip. 
  4. Test Implementation: Now, it is time to execute test cases on modules based on the requirements. These test cases evaluate components for functional and non-functional aspects. 
  5. Test Recording: Record the results of test cases and any bugs or errors identified. If there is the presence of bugs or issues, the testing team reports it to the development team for fixing. The above process continues until the testing team discovers no product errors. 
  6. Test Verification: This stage involves the testing team verifying whether the product meets specifications. 
  7. Completion: The last step is to analyze the results to determine the readiness of the software product. 

Example

Let us understand component testing with an example. 

Consider the development of a banking application for XYZ Bank. The application comprises various pages for each service the bank offers, such as Accounts, Insurance, Cards, Investments, etc. Here, each page is an individual component and is tested after its complete development. 

Assume that the Accounts page needs to be tested, but the login page is not yet developed. In this situation, the concept of a driver comes into play. 

To test the Accounts page, the testing team creates a driver simulating the functionality of the login page. As a result, the testing team can easily navigate the Accounts page and execute the necessary test cases. Once the login page is developed, the driver is replaced with it, and testers thoroughly validate its functionality. 

Similarly, the concept of the stub is used to test the Fund Transfer page, as it is dependent on the Add Payee page, which is not developed yet.

Component Testing vs Unit Testing 

Let us now understand the difference between component testing and unit testing. 

Component TestingUnit Testing
Testing components separately or without isolation to ensure their functionality against the requirements. Testing the developed code at the program level against the design specifications. 
Quality Assurance (QA) professionals or testers perform component testing. Developers perform unit testing. 
It is carried out after unit testing and before integration testing. It is the first level of software testing. 
Testers are not aware of the product’s internal structure. Hence, it is black box testingAs developers assess the code at the program level, unit testing is white box testing
It considers test scenarios and functional specifications for validation. It considers design specifications for validation. 
Once a component is fully developed, testers start validating it. Developers test a component at each stage of its development. 

Conclusion

This was all about component testing. The testing team validates a system’s every component individually or without isolation for its correctness and functionality. It is a cost-saving testing type that saves the entire development team from headaches in the future by eliminating all potential bugs and errors in the early stage.

Many individuals get confused about component and unit testing. The testing or QA team performs component testing on software modules against the requirements and test scenarios. Conversely, developers carry out unit testing on software modules against design specifications.

Advertisement

Leave a Comment