What is Integration Testing?
Integration testing is the testing of software by combining the individual units of that software or application. The testing can be performed after functional and unit testing. Another name for integration testing is string testing or thread testing. It involves various modules of an application and then testing their behavior as a unit. By integration testing, we verify that the individual unit is communicating properly with each other. Integration testing is required when the requirements are dynamic. Even after unit testing of each module, errors may still exist. For the identification of these errors’ integration testing is required.
Why integration testing is important?
Helps in testing the combination of different modules: After developing the different modules by different developers, the modules are combined to check the functionality. Different logics or understanding is implemented by each developer which can cause functional errors. To check these functional errors integration testing is required.
To check changing requirements are incorporated into the application: Many times, customer demands changes or add functionality in a particular module. These requirements may not be tested every time, which can lead to missed defects. Integration help to identify these defects sometimes.
Types of integration testing
There are four types of integration testing:
- Big-bang testing.
- Top-down testing.
- Bottom-up testing.
- Sandwich/hybrid testing.
1) Big-Bang Testing
In this testing, all modules are integrated at once and test them all as one unit. The testing is suitable for small systems or applications. The errors are easily identified in this testing, which saves time and speeds up the application deployment. But the difficulty which comes with big-bang testing is that it becomes hard to locate the source of the defect as different modules are combined in one unit. Also, large application testing consumes more time. And bugs may also get skipped in this testing. Testers have to wait for all modules for testing. It becomes more difficult to solve the errors as lots of errors come at the same time.
2) Top-down Testing
In this testing, the highest-level module test first and the lower-level module last, which means the testing flow is from the highest level to the lower-level module, and the testing of each module is done one by one and after testing each module, all the modules integrated to check the final software’s functionality. In this testing, defects can be identified easily. Testers first check the important units. The testing of the lower-level modules takes lots of time.
3) Bottom-up Testing
This testing is inversely proportional to top-down testing. In this testing, the lower-level module was tested first, and then the higher-level module was tested progressing incrementally. This testing can only be done if all the modules are available for testing. It is easy to find the faults and less time is needed for troubleshooting since all the modules are available at the same time. Since critical modules are tested at last. Critical defects may be missed by testers.
4) Sandwich/Hybrid Testing
This testing combines both top-down and bottom-up testing. In this testing, both stubs and drivers are used. It is used for large programs like operating systems or any other program like games etc. This testing is difficult and also the cost is high. A high skill level is needed.
How to do Integration Testing?
Testers use stubs and drivers to perform integration testing. These dummy programs act as substitutes for any missing modules. There are different testing tools that can be used for integration testing.
- Rational Functional Tester
Selenium is a tool that automates browsers. It supports different languages to write test scripts like Java, Python, Ruby, NodeJS, PHP, C#, etc
Pytest is a tool that supports the Python programming language. This tool is used to test mainly APIs. Butter databases and UI can also be tested by this framework.
Mockito is a java-based library used to test Java applications.
LDRA is used for the verification of compliance standards in organizations for integration testing.
Junit is used to write test cases for java and java virtual machines, it is an open-source framework.
A rational functional tester is used for regression, GUI, and data-driven testing. It is an object-oriented automated functional tool.
Integration Test Cases
The Above figures contain two features A & B. Now assume that some data is sent from feature A to feature B. The test case is to check the data is being sent from feature A and received by feature B
For the above scenario let us take an example of banking software (amount transfer)
Scenario 1 – Now login as user A to transfer the amount – send 200rs amount –After clicking on the transfer button, a message should be displayed saying ‘Amount is successfully transferred’ – now logout as user A and login as user B. Check the amount or balance in the account. The balance should be increased by 200rs. It is called integration testing.
Scenario 2 – Now log out as user B and log in again as user A and check if the amount balance has decreased by 200rs in A. If yes, the integration testing is successful.
Scenario 3 – Now click on transactions – in both A and B individually, the message should be displayed regarding the data and time of amount transfer.
The following points need to be remembered while doing integration testing
1) We have to understand the functions of the application.
2) Identify all possible scenarios
3) Prioritize all the scenarios for execution
4) Test all the scenarios
5) If you find defects, communicate a defect report to developers
6) Do positive and negative integration testing. Positive – if there is a total balance of 10,000 – send 1000rs and see if the amount transfer works fine – if it does, then the test is passed. Negative – if there is a total balance of 10,000 – send 15000rs and see if the amount transfer happens – if it doesn’t happen, the test is passed – if it happens, then there is a bug in the program and send it to the development team for repairing defects.
Let us take another example of Gmail software.
Let us consider Gmail software as shown below. The first thing is functional testing of a username and password functionality, send and cancel button. After performing the functional testing, we go for integration testing. The following scenarios can be considered,
Scenario 1 – Login as user A and click on compose mail. First, we check the upload attachment functionality and then the send button. After uploading the attachment and sending the mail to user B, we go to the sent item folder of user A to check that the sent mail is there. Now we log out as user A and log in as user B. After logging in as user B, we check whether is mail is received or not. If the mail is received, integration testing is successful.
Scenario 2 – After checking the sent email functionality. We also write the test cases for other functions like trash, spam, logout, etc.
Integration testing plays a crucial part in automation testing, it tells the two different module interfaces with each other. The two modules can be of two components, a subsystem, a whole system, or a collection of systems. Integration testing starts from the development cycle and continues for a lifetime. Whenever there are changes in the system or the addition of a feature, this testing always plays its role in finding the bugs/errors. It verifies that individual, as well as integrated modules, work perfectly in the development phase.