What is Integration Testing and How It is Performed?

Background

We have studied about various Software developments lifecycle models. All the SDLC models have Integration testing as one of the layers. In my opinion, Integration testing is actually a “level” of testing rather than a “Type” of testing.

Many a time we feel that Integration testing involves writing code snippets to test the integrated modules, so it is basically a white box testing technique. This is not fully wrong, but I feel the concept of Integration testing can be applied in Black box technique too.

When talking in terms of testing large application using black box testing technique, involves the combination of many modules which are tightly coupled with each other. We can apply the Integration testing technique concepts for testing these types of scenarios.

what is integration testing

In the subsequent section, I will try to elaborate the concept of Integration testing and its implementation in both White box and Black box technique.

Meaning:

We normally do Integration testing after “Unit testing”.

Once all the individual units are created and tested, we start combining those “Unit Tested” modules and start doing the integrated testing. So the meaning of Integration testing is quite straightforward- Integrate/combine the unit tested module one by one and test the behaviour as a combined unit.

The main function or goal of Integration testing is to test the interfaces between the units/modules.

The individual modules are first tested in isolation. Once the modules are unit tested, they are integrated one by one, till all the modules are integrated, to check the combinational behaviour, and validate whether the requirements are implemented correctly or not.

Here we should understand that Integration testing does not happen at the end of the cycle, rather it is conducted simultaneously with the development. So in most of the times, all the modules are not actually available to test and here is what the challenge comes to test something which does not exist!

Approaches

There are fundamentally 2 approaches for doing Integration testing:

  1. Bottom-up approach
  2. Top-down approach.

Let’s consider the below figure to test the approaches:

Integration 1

Bottom-up approach:

Bottom-up testing, as the name suggests starts from the lowest or the innermost unit of the application, and gradually moves up. The Integration testing starts from the lowest module and gradually progresses towards the upper modules of the application. This integration continues till all the modules are integrated and the entire application is tested as a single unit.

In this case, modules B1C1, B1C2 & B2C1, B2C2 are the lowest module which is unit tested. Module B1 & B2 are not yet developed. The functionality of Module B1 and B2 is that it calls the modules B1C1, B1C2 & B2C1, B2C2. Since B1 and B2 are not yet developed, we would need some program or a “stimulator” which will call the B1C1, B1C2 & B2C1, B2C2 modules. These stimulator programs are called DRIVERS.

In simple words, DRIVERS are the dummy programs which are used to call the functions of the lowest module in a case when the calling function does not exist. The bottom-up technique requires module driver to feed test case input to the interface of the module being tested.

The advantage of this approach is that, if a major fault exists at the lowest unit of the program, it is easier to detect it, and corrective measures can be taken.

The disadvantage is that the main program actually does not exist until the last module is integrated and tested. As a result, the higher level design flaws will be detected only at the end.

Top-down approach

This technique starts from the topmost module and gradually progress towards the lower modules. Only the top module is unit tested in isolation. After this, the lower modules are integrated one by one. The process is repeated until all the modules are integrated and tested.

In the context of our figure, testing starts from Module A, and lower modules B1 and B2 are integrated one by one. Now here the lower modules B1 and B2 are not actually available for integration. So in order to test the topmost modules A, we develop “STUBS”.

“Stubs” can be referred to as code a snippet which accepts the inputs/requests from the top module and returns the results/ response. This way, in spite of the lower modules, do not exist, we are able to test the top module.

In practical scenarios, the behavior of stubs is not that simple as it seems. In this era of complex modules and architecture, the called module, most of the time involves complex business logic like connecting to a database. As a result creating Stubs becomes as complex and time taking as the real module. In some cases, Stub module may turn out to be bigger than the stimulated module.

Both Stubs and drivers are dummy piece of code which is used for testing the “non- existing” modules. They trigger the functions/method and return the response, which is compared to the expected behaviour

Let’s conclude some difference between Stubs and Driver:

StubsDriver
Used in Top down approachUsed in Bottom up approach
Top most module is tested firstLowest modules are tested first.
Stimulates the lower level of componentsStimulates the higher level of components
Dummy program of lower level componentsDummy program for Higher level component

The only change is Constant in this world, so we have another approach called “Sandwich testing” which combines the features of both Top-down and bottom-up approach. When we test huge programs like Operating systems, we have to have some more techniques which are efficient and boosts more confidence. Sandwich testing plays a very important role here, where both, the Top down and bottom up testing are started simultaneously.

Integration starts with the middle layer and moves simultaneously towards up and down. In case of our figure, our testing will start from B1 and B2, where one arm will test the upper module A and another arm will test the lower modules B1C1, B1C2 & B2C1, B2C2.


Since both the approach starts simultaneously, this technique is a bit complex and requires more people along with specific skill sets and thus adds to the cost.

Integration testing GUI application

Now let’s talk about how we can imply integration testing in Black box technique.

We all understand that a web application is a multitier application. We have a front end which is visible to the user, we have a middle layer which has business logic, we have some more middle layer which does some validations, integrate some third party APIs etc., then we have the back layer which is the database.

Let’s check the below example:

I am the owner of an advertising company and I post ads on different websites. At the end of the month, I want to see how many people saw my ads and how many people clicked on my ads. I need a report for my ads displayed and I charge accordingly to my clients.

GenNext software developed this product for me and below was the architecture:

Integration 2

UI – User Interface module, which is visible to the end user, where all the inputs are given.
BL – Is the Business Logic module, which has all the all the calculations and business specific methods.
VAL – Is the Validation module, which has all the validations of the correctness of the input.
CNT – Is the content module which has all the static contents, specific to the inputs entered by the user. These contents are displayed in the reports.
EN – Is the Engine module, this module reads all the data that comes from BL, VAL and CNT module and extracts the SQL query and triggers it to the database.
Scheduler – Is a module which schedules all the reports based on the user selection (monthly, quarterly, semiannually & annually)
DB – Is the Database.

Now, having seen the architecture of the entire web application, as a single unit, Integration testing, in this case, will focus on the flow of data between the modules.

The questions here are:

  1. How the BL, VAL and the CNT module will read and interpret ate the data entered in the UI module?
  2. Is BL, VAL and CNT module receiving the correct data from UI?
  3. In which format the data from BL, VAL and CNT is transferred to the EQ module?
  4. How will the EQ read the data and extract the query?
  5. Is the query extracted correctly?
  6. Is the Scheduler getting the correct data for reports?
  7. Is the result set received by the EN, from the database is correct and as expected?
  8. Is EN able to send the response back to the BL, VAL and CNT module?
  9. Is UI module able to read the data and display it appropriately to the interface?

In the real world, the communication of data is done in an XML format. So whatever data the user enters in the UI, it gets converted into an XML format.

In our scenario, the data entered in the UI module gets converted into XML file which is interpreted by the 3 modules BL, VAL and CNT. The EN module reads the resultant XML file generated by the 3 modules and extracts the SQL from it and queries into the database. The EN module also receives the result set and converts it into an XML file and returns it back to the UI module which converts the results in user readable form and displays it.

In the middle we have the scheduler module which receives the result set from the EN module, creates and schedules the reports.

So where Integration testing does comes into the picture?

Well, testing whether the information/data is flowing correctly or not will be your integration testing, which in this case would be validating the XML files. Are the XML files generated correctly? Do they have the correct data? Are the data is being transferred correctly from one module to another? All these things will be tested as part of Integration testing.

Try to generate or get the XML files and update the tags and check the behaviour. This is something very different from the usual testing which testers normally do, but this will add value to the testers knowledge and understanding of the application.

Few other sample test conditions can be as follows:

  • Are the menu options generating the correct window?
  • Are the windows able to invoke the window under test?
  • For every window, identify the function calls for the window that the application should allow.
  • Identify all calls from the window to other features that the application should allow
  • Identify reversible calls: closing a called window should return to the calling window.
  • Identify irreversible calls: calling windows closes before called window appears.
  • Test the different ways of executing calls to another window e.g. – menus, buttons, keywords.

Why Integration?

We feel that Integration testing is complex and requires some development and logical skill. That’s true! Then what is the purpose of integrating Integration testing in our testing strategy?

Here are some reasons:

  1. In the real world, when applications are developed, it is broken down into smaller modules and individual developers are assigned 1 module. The logic implemented by one developer is quite different than another developer, so it becomes important to check whether the logic implemented by a developer is as per the expectations and rendering the correct value in accordance with the prescribed standards.
  2. Many a time the face or the structure of data changes when it travels from one module to another. Some values are appended or removed, which causes issues in the later modules.
  3. Modules also interact with some third party tools or APIs which also need to be tested that the data accepted by that API / tool is correct and that the response generated is also as expected.
  4. A very common problem in testing – Frequent requirement change! :) Many a time developer deploys the changes without unit testing it. Integration testing becomes important at that time.

Finally, in conclusion, some steps to kick off Integration tests

  1. Understand the architecture of your application.
  2. Identify the modules
  3. Understand what each module does
  4. Understand how the data is transferred from one module to another.
  5. Understand how the data is entered and received into the system ( entry point and exit point of the application)
  6. Segregate the application to suit your testing needs.
  7. Identify and create the test conditions
  8. Take one condition at a time and write down the test cases.

This is all about Integration testing and its implementation in both White box and Black box technique. Hope we explained it clearly with relevant examples.

About the author: This article is written by STH team member Shilpa C. Roy. She is working in software testing field for the past 9 years in domains like Internet advertising, Investment Banking and Telecom. She has also cleared the CTAL test manager exam with good score.

Let us know your queries in comments below.




Recommended reading

27 comments ↓

#1 Krishna

Article is very informative and very easy to understand..

Hi Shilpa, very soon i would be working on Investment banking domain,( preferably mortgages) request you to share info on the above domain and how to test.
Please share as an article or please share it to my mail id.

#2 Gopi

I it very good and informative article, Shilpa posses very good knowledge in testing as well as in teaching/explaining the topic. It is appreciable that the complex topic like integration testing has been explained in very easy manner. I think every one who has a little knowledge will understand this topic. Thanks a ton to shilpa.

#3 Gopi

I think every one who has a little knowledge in testing will understand this topic. Thanks a ton to shilpa.

#4 Chris Luck

nice post. mixed approach is good in most cases.

#5 Anthony

Thanks for the post

#6 Dinesh

Again thanks STH for the article especially about the two approaches for integration testing. Hope for some tools in future post….

#7 burcu

hello!
i tried to find it but i couldnt so i wanna ask something to you.
What is the EQ module?

#8 TKK

Very nice artical….very helpful for me !!

#9 Shilpa Chatterjee Roy

Thank you all for your comments and responses. It really keeps me motivated to improve on my quality.:)

@Krishna, Before you jump into Investment Banking domain, I would recommend you to read the articles from NCFM and try to find and give some certification on those. This will really help you on the domain front and eventually on testing. To design you Integration testing strategy, its important to understand the architecture and the data flow of your application. So go step by step. First understand the Domain, then the application , architecture and the break it to design your test strategy. Don’t forget to draw your scope here.

@Burcu – Its the EN module.

#10 Nits

Good article ..but again same query in my mind.
Can you please explain with practical example (like login page etc) which is higher module and which is lower module.

#11 kinjal

Thank you so much for sharing this article.It is very helpful

#12 mohini

Thank you so much for posting such a great useful understanding article. .very helpful

#13 Priyanka

What are error messages in integration testing?

#14 Nawal

Thanks a lot ma’am… You cleared my doubts on Integration Testing…

#15 Manisha S.

thank you so much mam.

#16 madhu

this article is very easy to understand………. thank u very much………

#17 This article cleared my concepts ..Thanks a lot.. but I have a query . Can you please tell me how many branches can be made in the diagram you explained while explaining Bottom Up & Top down approach

This article cleared my concepts ..Thanks a lot.. but I have a query . Can you please tell me how many branches can be made in the diagram you explained while explaining Bottom Up & Top down approach

#18 Deepanshu Arora

I want 400 Integration Test scenarios Of Gmail

#19 vignesh

I want 150 test scenarios of gmail

#20 swretha

very easy to understand. well explained

#21 Keshub

Great article! Thanks :)

#22 Imrankhan

This article is very informative. It deals with each & every concepts of Integration testing. Thank you so much

#23 nilesh

Hey,Excellent article really helpful.

#24 Preethi

Thanks for explaining integration testing with an example easy to understand. I have a question about the tools that are used for integration testing. What are the commonly used tools for this stage of testing?
Thanks.

#25 Naresh

Hi…Article is clearly understandable and its helpful…Thanks

#26 Mehul Mistry

Your Article is very nice … can you Provide real time Example on interface testing .

#27 gopi

The goal of integration testing is to make sure a system consisting of a number of components will function according to specifications when all the components are put together. If that is the case, why spend time testing interfaces between interacting modules? Why not just put them all together and test the system as a whole?

Can i arguments both for and against with examples?

Leave a Comment