Integration Testing: Real-life Example

Integration Testing: Real-life Example

7 mins read9.5K Views Comment
Anshuman
Anshuman Singh
Senior Executive - Content
Updated on Jul 16, 2024 17:36 IST

Integration testing involves checking individual components or units of a software project to expose defects and problems to verify that they work together as designed.This article explained Integration Testing with real life example.Types of integration testig also explained with real life examples.

2022_10_7.jpg

Integration testing is a software development practice commonly used to ensure the functionality of an application’s modules and components. Integration testing can be performed manually or automatically with tools such as Selenium. Manual integration testing is tedious and error-prone, whereas automated integration testing is too slow and inaccurate for most projects. Therefore, manually integrating your application’s modules and components before going through an integration test helps to catch bugs and verify that each module works as intended.

Table of contents

Recommended online courses

Best-suited Quality Assurance & Testing courses for you

Learn Quality Assurance & Testing with these high-rated online courses

11.5 K
3 months
– / –
300 hours
2.67 L
2 years
38 K
6 months
74.5 K
40 hours

What is Integration Testing?

Integration testing is testing in which software modules are logically integrated and tested as a whole group. A typical software project consists of multiple software modules coded by different programmers. This testing aims to find bugs in the software modules when they are integrated.

Look for ways to improve your integration test results. When performing manual or automated integration testing, always look for ways to improve performance and accuracy. One way to improve performance is using Python for all your unit tests. Python is a programming language that supports the development of both unit test suite codes without limitations. Therefore, it allows developers to write both unit and integration tests without limitations. Doing so saves time since developers can focus on writing high-quality code instead of struggling with slow unit testing tools.

Real-life Example of Integration Testing

Suppose a car company is making a car. A car will include modules like an ignition, braking, engine, exhaust, and fuel system. So first, these systems will be tested individually, which will be unit testing. If you want to understand unit testing with the example, we have already covered this topic in our previous article. But if different systems are tested in a combined way, then that will be integration testing. For example the fuel system may be tested in collaboration with an exhaust system, and later, these two module’s working is tested in collaboration with the working of an engine. Now, this is integration testing.

White Box Testing with Real Life Example
Automation Testing: With Real-Life Examples
Difference between Black box and White box testing

Also read: What Does A Software Engineer Do? Roles, Responsibilities, and Skills

Also read: A Day in Life of a Software Engineer – An Interview Log

Also explore: Software Engineer Online Courses & Certifications

Also explore: Free Software Engineer Courses Online

Why is Integration Testing?

Compatibility of modules

Integration testing is also considered the second level of the software testing process after unit testing.Thta means it is done after unit testing. A typical software project usually consists of many software modules, many of which are written by different programmers. Integration tests show the team how these different elements work together. After all, each entity can work perfectly on its own, but the immediate question is, “But can they work smoothly.

Ensure accurate data receiving

Data is usually modified in transit. Therefore, it’s important to ensure that everything received from the API is correct and the response is what you expect. For this purpose, integration tests are very valuable.

Challenges in Integration Testing

  • Integration testing means testing two or more integrated systems to ensure they are working correctly. In addition to testing the integration links, comprehensive environmental testing should be performed to ensure that the integration system is functioning correctly.
  • There may be various paths and permutations that can be applied to test the integrated system.
  • Integrating a new system into a legacy requires much change and testing. The same applies to the integration of any two legacy systems.
  • It complicates the management of integration tests because there are a few factors, such as databases, platforms, and environments. 
  • Integration of two different systems developed by two different companies, you don’t know how one of the systems will affect the other if changes are made to one of the systems. Therefore, it is a big challenge.
  • Several things should be considered to minimize the impact during system development, such as possible integration with other systems.

Types of integration testing

Big Bang Testing

This is the most straightforward integration testing approach, combining all modules and verifying functionality after completing each module test. Simply put, connect and test all the modules in your system. This approach is only practical for very small systems. If an error is found during integration testing, it can be complicated to identify, as the error could belong to any of the modules being integrated. Debugging errors reported during big bang integration tests are, therefore, costly to fix.

Bottom-up approach

In bottom-up testing, each module is tested at higher modules at lower levels until all modules are tested. The primary purpose of this integration test is for each subsystem to test the interfaces between the various modules that make up the subsystem. This integration test uses a test driver to drive the appropriate data and pass it to lower-level modules.

2022_10_MicrosoftTeams-image-22.jpg

In this case, we will start unit testing modules 4 and 5 first which are the lowest level modules. Modules M1 and M2 are not yet developed. The function of modules M2 is to call modules 4 and 5 Since module 4 and 5 have not yet been developed, you will need a program or “stimulator” that calls modules 4 and 5. These stimulus programs are called drivers. In simple words, DRIVERS are dummy programs used to call functions in the lowest module if the calling function does not exist. The bottom-up approach requires the module driver to deliver test case inputs to the module’s interface under test.

Real-life example, Paytm app have many features like paying bills, a shopping cart, transferring money to other accounts, buying movie tickets, and a Paytm wallet. Suppose the least priority feature they have is buying a movie ticket. So in a bottom-up approach buying movie ticket module will be tested first, then the second least priority feature will be tested with it in collaboration, and so on.

Top-down approach

2022_10_MicrosoftTeams-image-21.jpg

This technique starts with the top module and gradually progresses to the lower modules. Only top modules are tested individually. Then the modules below are integrated one after the other. This process is repeated until all modules are integrated and tested.

In the context of this diagram, testing starts with module 1 and integrates subordinate modules 2 and 3 one by one and then will integrate module 2 with module 4 and module 5 and so on.Here suppose submodule 2 and 3 are not ready. So, in order to test the top module 1, we will develop “STUBS” in place of module 2 and 3.

A “stub” can be described as a snippet of code that takes input/requests from the top-level module and returns results/responses. This way, the lower modules don’t exist, but the higher modules can be tested.

For example, In the Paytm app, the highest priority feature is transferring money from one account to another; then, it will be tested; first, the second highest module is tested with it in collaboration, and so on.

NOTE:Stubs are used for testing if some modules are not ready.

 

Sandwich testing 

2022_10_MicrosoftTeams-image-18.jpg

Mixed integration testing follows a combination of top-down and bottom-up testing approaches. A top-down approach allows testing to begin only after the top-level module has been coded and unit-tested. A bottom-up approach allows testing to start only after the lower-level modules are ready. This sandwich or mixed approach overcomes this shortcoming of top-down and bottom-up approaches.

Conclusion

Integration testing is an essential practice in software development that ensures the end product matches the developer’s expectations- it’s an essential step in the software development lifecycle! Since integration testing isn’t perfect and always requires fine-tuning, it’s always worth doing and improving!

FAQs

Why is integration testing important?

Integration testing is crucial because it helps identify issues that may arise when multiple components are combined and tested as a whole system. It ensures that the integrated modules work together correctly, catch any defects that arise due to integration, and validate the system's behavior.

What are the challenges in performing integration testing?

a) Test environment setup: Creating an environment that mimics the production setup with all the integrated components can be complex and time-consuming. b) Test data management: Managing test data across different components and ensuring data consistency can be challenging. c) Dependency management: Coordinating dependencies between modules, especially when changes or updates are made, can be difficult. d) Defect isolation: Identifying the source of defects or failures in the integrated system can be tricky, as issues may arise from the interaction between multiple components.

What is integration testing?

Integration testing is a software testing technique that focuses on verifying the interaction between different components or modules of a system. It aims to uncover defects in the interfaces and interactions between these components when they are integrated together.

About the Author
author-image
Anshuman Singh
Senior Executive - Content

Anshuman Singh is an accomplished content writer with over three years of experience specializing in cybersecurity, cloud computing, networking, and software testing. Known for his clear, concise, and informative wr... Read Full Bio