Unit 4 - Integration Testing
Unit 4 - Integration Testing
Integration Testing
Integration testing is testing in which a group of components is combined to
produce output.
The focus of the integration testing level is to expose defects at the time of
interaction between integrated components or units.
When we combine two units, we may like to test the interfaces amongst these
units.
We combine two or more units because they share some relationship.
This relationship is represented by an interface and is known as coupling.
The coupling is the measure of the degree of interdependence between
units.
Two units with high coupling are strongly connected – dependent on each other
Two units with low coupling are weakly connected – low dependency on each
other
Cont..
Integration testing need not wait until all the modules of a system are
coded and unit tested.
Instead, it can begin as soon as the relevant modules are available.
A module is said to be available for combining with other modules when the
module’s check-in request form is ready.
Some common approaches to performing system integration are as follows:
Incremental
Top down
Bottom up
Sandwich
Big bang
Incremental Approach
In each cycle, a new layer is added to the core and tested to form a new
core.
The new core is intended to be self-contained and stable.
Self-contained means containing all the necessary code to support a
set of functions
Stable means that the subsystem (i.e., the new, partial system) can
stay up for 24 hours without any anomalies.
Cont..
The number of system integration test cycles and the total integration
time are determined by the following parameters:
Number of modules in the system
Relative complexity of the modules (cyclomatic complexity)
Relative complexity of the interfaces between the modules
Number of modules needed to be clustered together in each test cycle
Whether the modules to be integrated have been adequately tested before
Turnaround time for each test–debug–fix cycle
Cont..
The software developer fills out a check-in request form before a new
software module or a module with an error fix is integrated into a build.
The form is reviewed by the build engineering group for giving approval.
Once it is approved, the module can be considered for integration.
The idea behind having a check-in request mechanism is:
All the files requiring an update must be identified and known to other team
members.
The new code must have been reviewed prior to its integration.
The new code must have been unit tested.
The scope of the check-in is identified.
Cont..
Drivers serve the same purpose as stubs, but drivers are used in Bottom-up
integration testing and are also more complex than stubs.
Drivers are used when high-level modules are missing and can also be used when
lower-level modules are missing.
Key Steps in the Top-Down Approach:
Incremental Integration:
Once the top-level module is tested and verified, the next set of lower-level
modules is integrated one by one.
Each time a new module is integrated, the system is tested to ensure that the
new module interacts correctly with the already tested modules.
Replace Stubs with Real Modules:
As lower-level modules are developed and become available, the stubs are
replaced with the actual modules.
Testing continues to ensure that each new module integrates smoothly with
the existing system.
Cont..
Progression Downwards:
This process continues, with integration and testing moving downwards
through the module hierarchy until all modules have been integrated and
tested.
Test Case Design:
Test cases are designed to validate the integration at each level, focusing on
the interactions between modules and the correct functioning of the
integrated system.
Example: Online Bookstore Website
Progress Downwards:
• As each lower-level module is integrated and tested, you move downwards in
the hierarchy until all features are fully integrated.
• For instance, after integrating the Search, you test how it interacts with the
Book Details Page.
• After integrating the Shopping Cart, you test how items are added from the
Book Details Page to the cart.
• Finally, you test the Checkout Process to ensure it works with the items in the
Shopping Cart.
Bottom-Up Approach
In this method, testing starts with the lowest-level modules (those that
do not depend on other modules) and gradually moves upward through
the hierarchy, integrating and testing higher-level modules as you go.
Incremental Integration:
• Once the Database Access Layer is thoroughly tested, integrate it with the
Search Functionality.
• Replace the driver used for search simulation with the actual Search module.
Test this integration to ensure that search queries correctly retrieve data from
the database.
• Similarly, integrate and test the Shopping Cart module next. Ensure that it
can retrieve book details from the database and correctly add items to the
cart.
Cont..
Progress Upwards:
• After integrating the Shopping Cart, move on to the Checkout Process. Test
this module by ensuring that it correctly interacts with both the Database
Access Layer (to store order details) and the Shopping Cart (to retrieve cart
items).
• Finally, integrate the Homepage, which is the top-level module that ties
everything together. The Homepage should correctly display featured books,
handle search queries, and allow navigation to the Shopping Cart and
Checkout Process.
Cont..
This approach is often considered the simplest but can be risky because
it waits until everything is developed before any integration testing
begins.
How the Big Bang Approach Works?
Development Phase:
Each module or component of the software is developed independently
without any prior integration testing.
Integration Phase:
Once all the modules are developed, they are integrated together in one go.
Testing Phase:
After integration, the system is tested as a whole to identify any defects or
issues.
Example: Developing a Mobile
Banking Application
Consider the development of a mobile banking application that includes
several modules, such as:
1. User Authentication: Handles login, registration, and password
management.
2. Account Management: Displays account balances, transaction history,
and account details.
3. Fund Transfers: Allows users to transfer money between accounts or
to other users.
4. Bill Payments: Manages the payment of bills and viewing payment
history.
Applying the Big Bang Approach:
Independent Development:
Each module—User Authentication, Account Management, Fund Transfers, and
Bill Payments—is developed by separate teams without any prior integration
testing between them.
Integration:
Once all the modules are completed, they are integrated together in one large
step. This means that the User Authentication module is combined with the
Account Management, Fund Transfers, and Bill Payments modules all at once.
System Testing:
After integration, the entire mobile banking application is tested as a single
system. The testing team checks the flow from user login to account
management, fund transfers, and bill payments.
Challenges and Risks:
This testing phase aims to identify issues that may arise when modules
interact with each other.
4) Interoperability testing
Ensures that the API can interact correctly with other APIs, systems, or components.
Example: Verifying that the API correctly handles data from another service or API
and returns the expected result.
5) Usability Testing
Assesses the API’s usability from the perspective of developers and end-users,
ensuring that it is easy to understand, use, and integrate.
Example: Reviewing the API documentation and error messages to ensure they are
clear and helpful.
Cont..
3) OAuth Authentication
OAuth is a technique that does both authentication and authorization. It is a form of
API authentication that allows applications to communicate with API server to
provide access.
OAuth authentication is fundamentally a more secure and powerful system than the
others.
Test Automation or Automation testing
Test Automation is the best way to increase the effectiveness, test
coverage, and execution speed in software testing.
Test Set-up
Test Parameters
Test Integration
Test Results
Actions
Test Automation
Test Set-up
Test Set-up involves preparing the environment where the integration
tests will be conducted.
This includes configuring the hardware, software, network, and other
necessary resources.
Test Results are the outcomes of the executed integration tests. They
indicate whether the test scenarios passed or failed.