What Is Integration Testing And Its Types?
What is integration testing?
Integration Testing (or I&T: Integration & Testing) is a type of software testing in which various units, modules, and components of the software are integrated and tested as a cohesive unit. With Integration Testing, testers want to find defects that surface due to code conflicts between software components when they work together. This level of testing is higher than unit testing, which only validates if software components function well as a single unit.
Integration testing occurs after unit testing, ideally after functional testing, and before system testing. The modules that have passed unit testing will be grouped together. After that, they create a test strategy, perform testing, and make recommendations where necessary.
Why is integration testing important?
Software is often built from many individual software components or modules. These modules may pass unit testing and work perfectly fine individually, yet collapse when put together, for various reasons:
- Inconsistent code logic: They are coded by different programmers whose logic and approach to development differ from each other, so when integrated, the modules cause functional or usability issues. Integration testing ensures that the code behind these components is aligned, resulting in a working application.
- Shifting requirements: Clients change their requirements frequently. Modifying the code of 1 module to adapt to new requirements sometimes means changing its code logic, which affects the entire application. These changes are not always reflected in unit testing, hence the need for integration testing to uncover the missing defects.
- Erroneous Data: Data can change when transferred across modules. If not properly formatted when transferring, the data can’t be read and processed, resulting in bugs. Integration testing is required to pinpoint where the issue lies for troubleshooting.
- Third-party services and API integrations: Since data can change when transferred, API and third-party services may receive false input and generate false responses. Integration testing ensures that these integrations can communicate well with each other.
- Inadequate exception handling: Developers usually account for exceptions in their code, but sometimes they can’t fully see all of the exception scenarios until the modules are pieced together. Integration testing allows them to recognize those missing exception scenarios and make revisions.
- External Hardware Interfaces: Bugs can also arise when there is software-hardware incompatibility, which can easily be found with proper integration testing.
Integration testing protects you from those downfalls. There are numerous benefits to this practice:
- Ensure that software modules and components work together in harmony
- Integration issues are caught early on in the development cycle
- Allow you to perform regression testing on important connection points
- Uncover ad-hoc tests that you might not have even thought of
Types of integration testing
There are several strategies to perform integration testing, each of which has its own advantages and disadvantages, with the 2 most common approaches being:
- Big Bang Approach
- Incremental Approach
Incremental Approach is carried out by 3 different methods:
- Bottom-up approach
- Top-down approach
- Sandwich approach
Big Bang integration testing
Big Bang Integration testing is an integration testing approach in which all modules are integrated and tested at once, as a singular entity. The integration process is not carried out until all components have been successfully unit tested.
Advantages:
- Suits simple and small-sized system
- Little to no planning beforehand required
Disadvantages:
- Costly and time-consuming for large systems with a huge number of units as testers have to wait until all modules have been developed to start starting the testing process
- Hard to isolate and pinpoint bugs in specific modules
Solutions:
- Clearly define the interactions between each units/functions before testing to minimize missing defects
- Perform extensive logging for more accurate fault localization
- Perform Big Bang testing for simple applications
Incremental integration testing
Incremental integration testing is a type of integration testing approach in which 2 or more modules with closely related logic and functionality are grouped and tested via stubs and drivers. After that, testers continue to select and group other related modules together for testing. These groups of modules can also be grouped together for incrementally higher levels of testing, until all logically related modules have been fully integrated and tested.
Advantages:
Incremental testing is a more detailed approach than Big Bang testing, allowing for easier and more accurate fault localization
- High-risk modules can be prioritized for in-depth testing
- Earlier bug detection as incremental testing can be performed as soon as the modules are coded
Disadvantages:
- Require thorough planning and design
- Require a complete definition and logic of the system before it can be broken down into small units
- More resource-intensive
Solutions:
- Have an automated testing tool to reduce the workload, especially when a large application is tested
- Perform integration test early (right after unit testing) to provide a constant feedback loop
Testers can either choose to perform incremental integration testing bottom-up or top-down, depending on their need and resource availability.
Bottom-up approach
With the bottom-up approach, testers prioritize the sub-modules in the test plan. The reasoning is that the test result of critical, higher-level modules is only reliable when their foundational modules are performing well.
When some higher-level modules are under development and not ready for testing, testers can also create temporary replacements called “drivers”. These drivers simulate the data communication of the missing modules, allowing testers to perform continuous integration testing even when the application is not complete.
Advantages:
- Inherit all advantages of Incremental integration testing
- High test reliability
Disadvantages:
- Inherit all disadvantages of incremental integration testing
- High-impact modules that control the application flow are tested quite late in the development life cycle. If these modules have defects, lower-level modules may need to be revised
- Not possible to obtain an early prototype
- Complex and data-intensive
Solutions:
- Determine the test strategy early on to better prepare the test data and test case
- Discuss with the development team to have a general idea of application’s architecture design before testing
- Identify the necessary drivers to code before testing
- Only use when all or most of the modules of the same development level are ready
Top-down approach
With the top-down approach, testers prioritize the integration of higher-level modules. Testing applications from the top down focuses on revealing design and architectural flaws.
In certain cases, when some lower-level modules are not ready for testing, testers can also create dummy programs called “stubs” as temporary replacements for the actual modules, similar to the “drivers” of the bottom-up approach.
Advantages:
- Inherit all advantages of incremental integration testing
- Easier to obtain an early prototype
- Critical modules are tested first, allowing major flaws to be fixed first, which can improve confidence in the development life cycle
- Simple and not data-intensive
Disadvantages:
- Inherit all disadvantages of incremental integration testing
- Lower-level modules can be inadequately tested
Solutions:
- Automate wherever possible to ease up the workload
- Define the test strategy in detail to minimize missing modules
Sandwich Approach
Sandwich Testing (also known as Hybrid Integration Testing) is a type of software integration testing in which testers employ both top-down and bottom-up testing simultaneously. With this approach, testers can have a broader understanding of the application. Sandwich Testing requires the tester to develop both “stubs” and “drivers” to substitute for missing modules.
Advantages:
- Sandwich Testing is hybrid, and therefore can neutralize the disadvantages of the top-down and bottom-up approach
- Suitable for large-scale applications that’s interconnected with different sub-systems
Disadvantages:
- Complex and require a lot of beforehand planning
- Require a lot of technical expertise with stubs and drivers
Solutions:
- Work with the development team to have a long-term vision of the development process
Examples of integration testing case
In simple terms, integration testing is about trying to see how 2 or more things work together. We can perform it to see how 2 service classes interact with each other, how a service interacts with a datastore, how the UI responds to the backend.
In the case of an eCommerce website, there are several integration test cases to consider:
- Verifying the interface link between the Get Started page and the Login page. Once a user enters their credentials, it is expected that the system will check if their credentials are correct, and if they are, the user will be directed to the Get Started page as a logged in user
- Verifying that when the user inputs their information into a form, the right data is sent to the right place, in the right format
In the case of a banking application, these are the common integration testing cases:
- Verifying if the balance of the user is deducted by the correct amount that they sent, and if the balance of the recipient increased by the correct amount, after accounting for fees.
- Assuming that the bank has a bonus point system. Integration testing can verify if they have increased bonus points after a certain activity is recorded.
To have a holistic integration test strategy covering all aspects of the application, it is crucial for testers to align with the developers and clients on their vision, and optimize their strategy along the way. No matter what, it is still essential to follow integration testing best practices:
- Ensure that all modules have been unit tested before moving to the integration phase
- Carefully plan out integration test strategy before execution
- Validate the input test data for higher test reliability
Key Takeaway
Integration testing is an essential part of software testing as it validates if the modules can communicate well with each other, which is something that can’t be tested with unit testing. We can take either the Big Bang approach or the Incremental approach to integration testing, both with their own advantages and disadvantages.
Performing integration testing typically involves API and UI Integration Testing. However, professionals may not be able to perform those tests in one place, and have to constantly switch from 1 tool to another when they need to perform different testing types.
Katalon for Integration Testing
The Katalon Platform is a powerful All-in-One platform to help QA teams plan and design test cases in 1 place without having to use any additional tools. Katalon also supports a wide range of application types, including API Testing and UI Testing to cover all of your needs.
Increased test coverage
Another pain of testers performing UI Testing is the huge number of devices and browsers to test the application on. The UI of an application may look perfectly fine on this device, but is messy on another due to differences in screen sizes, resolution, or other technical specifications. Katalon allows you to stay within budget thanks to its cross-platform, cross-browser testing capabilities on cloud environments.
Reduce test maintenance effort
Katalon Platform is also built for test maintenance. When an application is updated, testers need to review if their test cases need to be adapted for the code changes. This is a daunting task that Katalon Platform can help you with thanks to its page object design model approach. Katalon stores locators across tests in an object repository. When changes occur, locators and artifacts are already grouped together to make updates easily.