What is Integration Testing?
Integration Testing is described as a process in which several software modules are logically integrated and tested. In this process, multiple modules are first individually tested and then tested as a single integrated unit. The whole group is reviewed to see whether the integrated module is working as expected.
It is a pragmatic approach to software development that takes a careful process to develop a product through continuous testing and revision. This is done by gradually integrating modules or components of an application.
This test type is applied and aggregated to test and defined within an integration test plan performed locally. Integration tests provide an integrating system and a system ready for the test. The primary focus of these tests is to test the interaction between different components.
Integration tests are of immense importance, as all components and modules are combined and tested. The integration test becomes a vital need for any company when it plans to move into a new business model, new technologies, or even new products or services. Integration tests are an essential part of the testing cycle, allowing the testers to find deficiencies after integrating multiple units.
Why Integration Testing?
- Tests are more reliable and more comfortable to isolate the failures.
- Dummies or stubs and drivers can be used.
- Integration testing brings confidence in the developer.
- Faster test runs.
- Integration testing starts at a very early stage of the development life cycle, and developers can catch bugs earlier than late.
- Integration tests catch system-level errors, such as a broken database scheme and wrong cache integration.
- More comfortable to test in a developing environment.
- Creating the right test gives a precise feedback loop mechanism between both developers and testing engineers.
- Better code coverage.
- More comfortable to track code coverage.
- Majorly helps to build real-time use cases during the end to end testing.
What are Stubs and Drivers in Integration Tests?
Stubs and drivers are pseudo-codes or dummy codes used to test integration components when one or more modules are not developed and are needed to test other modules. It is a program that provides hard encoded codes as input accepts the output of a module in the integration test.
Commonly referred to as “calling programs,” stubs and drivers are desirable from the top down in integration tests’ methodology. In contrast, drivers apply for the Bottom-up approach. Stubs and driver testers can utilize and stimulate the behavior of the modules that are not yet integrated with the software. Moreover, they help simulate the activity of the missing components.
What are the Types/Approaches to Integration Testing?
Big Bang Integration Testing:
A big bang integration test is a beneficial approach to software testing; it equips developers with a full set of integration tests for their software, systems, and applications at the beginning of integration tests.
Big bang integration testing is the continuous testing that occurs before system segments form the system. It is one of the most promising approaches to software testing, where the constant integration of systems and components leads to the formation of a complete system or application.
- Useful for small systems.
- The main advantage is that everything is finished before integration testing starts.
- Very time consuming
- Difficult to trace the cause of failures because of the delayed integration.
- The chances of having critical failures are more because, in big bang testing, all the components are tested together simultaneously.
- There is a high possibility of the occurrence of critical bugs in the production environment.
- If any bug is found, it is getting extremely difficult to detach all the modules to determine its root cause.
Incremental Integration Testing
In Incremental Integration tests, the programmers integrate the modules using stubs or drivers to uncover the defects one by one. In this approach, testing is performed by blending two or more modules logically related to each other and then tested concerning its proper functioning. The other related modules are integrated incrementally, and the process continues until all the logically related modules are integrated and tested successfully. In contrast, the big bang is another integration testing technique, where all the modules are integrated into one shot.
Incremental testing is of two types.
1. Top-Down Approach:
Top-down integration testing is the approach where a component is created at a lower level and integrated into a component at a higher level. The top-down integration tests focus more on integrating components at the top than the bottom. Developer can use stubs for this approach. This approach is for a wide range of endeavors, such as goal setting, budgeting, and forecasting.
The top-down integration test approach first tests the high-level modules and then the increasingly lower-level modules. This method allows tests to be carried out from the top-down, tracking control flows and architectural structures, with integration tests starting from the top down. The most common application is the top-to-bottom approach using stubs for integration tests and the test’s output.
- This method does not impact Operation and maintenance resources as severely as the bottom-up approaches.
- Fault localization is easy.
- An early prototype can be obtained easily.
- Major design flaws could be found and fixed first.
- Priority Modules can be tested first.
- The advantage of this approach is that decisions can be made and implemented very quickly.
- This approach requires many Stubs.
- Modules at a lower level are tested inefficiently.
- Provides limited coverage in the first phases.
- Developers might have to develop custom adapters at an early stage.
- The implementation cost is likely to be higher.
2. Bottom-Up Approach:
The bottom-up approach is the opposite of the top-down integration test: modules in the lowest layer are first tested and integrated and then integrated sequentially with other modules on the move.
Bottom-up integration tests begin with unit tests, followed by modular construction. First, the parent module is tested, then the child module, and so on until it is integrated.
The test driver is driven and passes the corresponding data from the low-level module, and when the code in the other module is ready, the driver replaces the actual module. The lower module is tested, and the higher-level modules are tested in the same way as in a top-up integration test, but with a different driver.
- Easier fault localization.
- Time taken to follow the bottom-up approach is way less than other testing methods.
- User awareness of the product.
- Automation can replace many manual processes.
- Easier test observations.
- Advantageous if major flaws occur towards the bottom of the program.
- The program, as a whole, does not exist until the last module is added.
- An early prototype is not possible.
- The bottom-up strategy is run by the existing infrastructure instead of the business processes.
- Compulsory modules (at the top level of software architecture) that control the application flow are tested last and may be prone to defects.
Sandwich / Hybrid Testing
Sandwich Testing is a union of the bottom-up and the top-down approach, so it exploits the advantage of both the bottom-up approach and the top-down approach.
During that phase, the interface and the communication between each module are tested. It is also known as Hybrid Integration Testing. Modified sandwich tests are incredibly beneficial, helping testers test different system components while they are integrated.
- The sandwich testing approach is useful for extensive projects which have sub-projects.
- It allows parallel testing.
- It is time effective.
- Developers appreciate this approach because they combine benefits of all associated testing frameworks, helping professionals leverage all that’s best about them in a clear-cut manner.
- Sandwich Testing is quite expensive.
- Sandwich Testing cannot be used for systems, which has a lot of interdependence with different components/modules.
- In sandwich testing/hybrid testing, the need for stubs and drivers is very high.
- The testing can get complicated.
- Difficult to localize faults.
- Mixed testing requires high cost.
- This approach is not suitable for small projects.
How to do Integration Testing?
Usually, integration testing comes after unit testing. Once all the individual units and tested, developers start to combine those tested modules and start performing the integration testing. The main goal of the process here is to test the interfaces between the units/modules.
- Prepare a design.
- Choose the type of testing approach from the list above.
- Select the test cases, outlines, and scripts accordingly.
- Deploy the chosen units together and get the integration tests running.
- Track the defects and bugs to record the test results of tests.
- Repeat the above points until the whole system is tested.
The priority of the process must be on the interface links that are integrated between modules.
Best Tools for Integration Testing :
VectorCAST/C++ is an automated unit and integration testing solution used for validating the safety and market -critical embedded systems. This dynamic testing solution is extensively used in industries like avionics, medical device, automotive, industrial controls, railway, and financial sectors.
Citrus is an open-source framework that can help developers automate integration testing for any messaging protocol or data format. Citrus is the framework of choice to test your application’s messaging integrations.,If using a messaging transport such as HTTP, REST, SOAP, or JMS.
LDRA lets developers perform unit and integration tests on the host and target device. With LDRA, developers can quickly and easily generate and execute tests at the unit and integration levels, both on the host (standalone or with target simulation) and the target hardware.
These days several businesses are fostering business-oriented architecture. The traditional integration testing method, like the bottom-up approach, requires considerable efforts to create test data. Wipro’s Smart Integration Test Accelerator (SITA) helps developers to overcome these challenges. This framework allows developers to accelerate the generation of Test Data and Test Design.
Rational Integration Tester(RIT) is an Integration Testing Tool previously known as Green Hat. IBM acquired Green Hat in 2012. With IBM’s Rational Integration Tester, developers can get a scripting free environment, and development is possible for SOA messaging tests and integration projects. Rational Integration Tester hinders integration problems with the help of iterative and agile development methods. The tool is now a part of the Rational Test Workbench.
Tips for Integration Testing :
- Run integration tests until you find at least one fault.
- After isolating a fault, solve it right away by adding or modifying the code.
- Practice integration testing only after correctly carrying out unit testing.
- Log your progress helps; developers better analyze the failure and maintain a record of potential reasons for the failure.
- Logging helps you analyze the failure and maintain a record of potential reasons for the failure, as well as ruling out other explanations, narrowing down the actual cause.
- Make sure your testing and development environments match.
- Use valuable test data.
- Use a common repository for bugs and tests.