Integration Testing

Introduction

Software testing is a process which lasts throughout the development lifecycle of the product. In this tutorial, we will learn about the next level of testing called Integration testing. Integration testing, as the name suggests, combines unit tested components and tests them together with their interfaces. Hence, Integration testing requires unit tested components as the test basis.

You can read about Unit Testing

As we know, bugs can enter anytime into the system. In general, any minor glitch can lead to a deviation from the requirements. For instance, the two developers can understand the requirement differently. Therefore, their code will not adhere to the requirements when combined together. Hence, it is important to validate the behavior of software components when together.

What is Integration testing

Integration testing is the validation of software individual components when combined together. In integration testing, testers test the interfaces between the different modules. These modules combine together to form a bigger component or the system. Hence, it becomes very crucial to validate their behavior when they work together. Apart from the interfaces, they also test the integrated components. Integration testing is the next level of testing after unit testing. Testers do it after completion of the unit testing phase. Integration testing techniques can be a white box or black box depending on the project requirements.

Example

Let us consider one example. Two developers Amy and Ben are working on a project to design a puzzle. Each would develop one side of the puzzle before the deadline. The player of the puzzle will combine the pieces to form the solution of the puzzle.

The output of Amy’s module :

The output of Bens module:

And hence the project was declared as failed. Any idea which step could have ensured the right output of their project?

Integration testing steps

Below is the typical Integration testing process of any project:

Planning

  • Requirement analysis
  • Evaluation of test modules
  • Evaluation of interfaces
  • Test plan and case development
  • Environment setup
  • Test data setup
  • Decide exit criteria

Test Execution

  • Execute the test cases
  • Register the test results and decide on pass and failure
  • Bug reporting
  • Reverify the bug fixes

Test closure

  • Test report preparation
  • Evaluation of exit criteria
  • Test phase closure

Integration testing techniques

There are various techniques for doing Integration testing. Each integrates the individual components in a different fashion. In general, the testing technique selected depends on projects size, complexity, and timeline.

 

Integration Testing

Big bang Integration testing

In the Big bang integration testing approach, testers integrate all the modules of the system together at once as a whole and then test the final resultant system. Quite often, there is a confusion between the system and integration testing but the objectives of both the testings are different. Integration testing targets the interfaces and links between modules while system testing validates the functionality of the entire software system.
The big bang approach is usually followed for smaller systems. For bigger systems, it becomes difficult to root cause the failures.

Pros

  • Easy to implement

Cons

  • Delay as all modules should be ready
  • Isolation of the defective module is difficult

Top-down Integration Testing

In the Top-down integration testing approach, the individual modules are combined from the top level of the hierarchy. At times, bottom level modules are not available. Hence, the stubs are used to simulate the input-output behavior of the lower modules which are not available for now. Stubs are nothing, but the programs which have hard-coded values to provide the input and accept the output to the modules which are under integration test.

For instance, we have Login page ready for the website but Home page functionality is not yet there. Therefore, a simple stub realizes the functionality of the Home page. When we test the Login page, the dummy Home stub program will be able to accept or reject logins for the test data.

Pros

  • Its an incremental approach so can be started with top-level modules.
  • Easy to locate the source of the bug

Cons

  • Stubs require programming knowledge and time for development
  • Due to the usage of the dummy module, testing can be ineffective.

Bottom-up Integration Testing

In the Bottom-up integration testing, individual modules are combined from bottom to top level of the hierarchy. Although, it is also an incremental approach but exactly opposite of the Top-down approach. Basically, it starts by combining the lower level modules, moving upwards to the higher level modules.

Usually, because higher level modules are not available for testing, the Driver dummy programs help with their input-output behavior. The Driver program mimics the functionality of higher level modules so that the lower level modules can be tested.

Taking the example from the Top-down approach, now the Home page is ready for testing but the Login page is not available. Therefore, we will create a driver program to send the test login details to the Home page program and now test the Home page links.

Pros

  • Its an incremental approach so can be started with bottom-level modules.
  • Easy to locate the source of the bug

Cons

  • Drivers require programming knowledge and time for development
  • Due to the usage of the dummy module, testing can be ineffective.

Hybrid Integration Testing

The Hybrid integration testing approach combines Top-down and Bottom-up methodologies. It is also called Sandwich approach.  In Hybrid integration testing, the integration of modules begins from the middle layer. Then, the testing moves in the upwards and downwards directions both. It helps in faster testing of the module’s interfaces. At times, this type of testing uses both stubs and drivers as per the requirement.

Pros

  • Its an incremental approach so can be started with few modules.
  • Easy to locate the source of the bug
  • Combines the benefits of both top-down and bottom-up approaches
  • It is faster
  • It is suitable for large projects

Cons

  • Stubs and Drivers require programming knowledge and time for development
  • It involves high cost of testing as more resources with good knowledge are needed.
  • Due to the usage of the dummy module, testing can be ineffective.

Advantages of Integration testing

  • It helps to find defects from links and interfaces between the modules.
  • It boosts the confidence level of the team in the product as it validates the group of modules together.
  • Integration tests run faster than the end to end test scenarios.
  • It results in higher code coverage.
  • It starts in the early stages when all the module may not be ready. Hence, it avoids the bugs getting into the system.

Challenges of Integration testing

  • Integration test strategy is very crucial to testing.
  • Most of the programs and data required are mocked. Hence the development of test harness requires time and good programming knowledge.
  • At times, when mocked data is replaced with real modules, new bugs can be discovered.

Conclusion

Testers should test the software at every stage of its development. After components are unit tested, it is crucial to validate them when combined together and also the links between them. This article provides insight into Integration testing and its various techniques.

References

https://en.wikipedia.org/wiki/Integration_testing

Translate »