Software Testing
Integration Testing
Phan Thi Hong
Lecturer
Faculty of Information Technology
Van Lang University
© 2016
Lecture Learning Objectives
Objectives
▪ Examine the goals of integration testing and its
approaches
Outcomes
▪ Understand what integration testing is and when it is
applied
▪ Know how to approach integration testing along with
advantages and disadvantages of each approach
2
Outline
Introduction to Integration Testing
Integration Testing Procedures
Strategies of Integration Testing
3
08 | Integration Testing
8.1. Introduction to Integration
Testing
Section Overview
In this section, we will review the following:
▪ Definition, goal and importance of integration testing
▪ When is integration testing applied?
▪ Concepts of driver and stub
5
Guiding Questions
What is integration testing?
When is integration testing applied?
What are goals of integration testing?
6
What is Integration Testing?
Integration testing is
performed to detect
defects in the interfaces
and interaction between
integrated components or
systems.
7
When is integration testing applied?
8
Goal and Importance of Integration Test
Integration testing has two major goals:
▪ to detect defects that occur on the interfaces of units;
▪ to assemble the individual units into working subsystems and
finally a complete system that is ready for system test.
The importance of integration testing stems from
three reasons as outlined below.
▪ Interface errors between modules created by different
programmers and even by the same programmers are
rampant.
▪ Unit testing of individual modules is carried out in a
controlled environment by using test drivers and stubs.
▪ Some modules are more error prone than other modules,
because of their inherent complexity.
9
Driver and Stub
10
A stub is:
Driver and Stub • a computer program statement
substituting for the body of a software
public class myCalculator { module that is or will be defined
//method under test elsewhere (IEEE, 1990)
public int Add(int iNum1, int iNum2) { }
}
• or a dummy component or object used to
simulate the behavior of a real
component (Beizer, 1990) until that
component has been developed.
public class myMath {
A driver is: public void AddTests() {
• a software module used to int iNumber1 = 30;
invoke a module under test int iNumber2 = 70;
and, often, provide test inputs, myCalculator cal = new myCalculator();
control and monitor execution,
//call to method under test
and report test results (IEEE,
int iResult = [Link](iNumber1, iNumber2);
1990)
• most simplistically a line of [Link](“Result of addition between ” +
[Link]() + “ and ” + [Link]() +
code that calls a method and
“ is ” + [Link]());}
passes that method a value.
}
11
Section Questions
What is integration testing?
When is integration testing applied?
What are goals of integration testing?
What do driver and stub mean?
08 | Integration Testing
8.2. Integration Testing
Procedures
Section Overview
In this section, we will review the following:
▪ Activities of integration testing.
• Prepare the Integration Testing Plan
• Design the test scenarios/test cases/test scripts
• Build integration testing environment
• Execute the test cases followed by reporting the defects
• Track and re-test the defects
14
Guiding Questions
Which activities should be conducted for
integration testing?
What are entry/exit criteria for integration
testing?
Which information should be included in an
integration test plan?
15
Integration Testing Procedures
1. Prepare the Integration Testing Plan
2. Design the test scenarios/test cases/test scripts
3. Build integration testing environment
4. Execute the test cases followed by reporting the
defects
5. Track and re-test the defects
6. Repeat steps 4 and 5 until the completion of
integration is successfully
16
Plan for Integration Testing
When planning for integration testing, you should
consider the following questions:
1. What modules or objects should be assembled and tested
as a group?
2. What are the functional subassemblies?
3. What are the critical features?
4. How much testing is appropriate?
5. Are there any implementation-based testing objectives?
6. How much scaffolding code or test support code is
required?
7. How will problems be isolated?
8. How is testing coordinated with system and unit testing?
17
Plan for Integration Testing
Brief description of a test plan:
1. Methods/Approaches to test
2. Scopes and Out of Scopes Items of Integration
Testing.
3. Roles and Responsibilities.
4. Pre-requisites for Integration testing.
5. Testing environment.
6. Risk and Mitigation Plans.
18
Plan for Integration Testing
Entry criteria to integration testing phase in
any SDLC:
▪ Unit tested components/modules.
▪ All high prioritized bugs fixed and closed.
▪ All modules to be code completed and integrated
successfully.
▪ Integration test plan, test case, scenarios to be
signed off and documented.
▪ Required test environment to be set up for
integration testing.
19
Plan for Integration Testing
Exit Criteria
▪ Successful testing of integrated application.
▪ Executed test cases are documented
▪ All high prioritized bugs fixed and closed
▪ Technical documents to be submitted followed by
release notes.
20
Design Integration Test Case
The core of integration testing design is to determine
an integration strategy which indicates the integration
steps necessary to satisfy the test requirements.
Integration Test case differs from other test cases in
the sense it focuses mainly on the interfaces & flow
of data/information between the modules. Here
priority is to be given for the integrating links rather
than the unit functions which are already tested.
Consider the following simple example:
21
Design Integration Test Case
Application has 4 modules:
Login, List of students, Add Login
Student, Delete Student.
We do not concentrate too List of
students
much on testing each
module as they’ve already
being done.
Add Delete
Students Students
We focus only on testing the
interaction between Login –
Figure 13.1 – Four modules in the sample of
List of Student; List of integration test cases
Student – Add Student; List
of Student – Delete Student
22
An Integration Test Case Example
TC TC Steps Expected
Objective Results
1 Check the [Link] inputs ‘test01’ for The screen of
interface Username and ‘1234’ for student list is
link Password. displayed with
between the [Link] clicks on Login button. default of 25
Login and items (added
List of newer is on the
Students top of list).
module.
23
An Integration Test Case Example
TC TC Steps Expected Results
Objective
2 Check the [Link] clicks on button Add on - Data is saved and
interface link screen of student list. screen of Add New
between the At the screen of Add New Student is closed.
List of Student: - Student A
Students and Nguyen Van is on
[Link] inputs:
Add Student the top of list on
• First Name: A
module. the screen of
• Last Name: Nguyen Van
student list.
• Date of Birth: 12/04/1991
• Gender: Male
• Faculty: CNTT
[Link] clicks on button Save
24
An Integration Test Case Example
TC TC Steps Expected
Objective Results
3 Check the [Link] selects student A Student A
interface Nguyen Van from the list of Nguyen Van is
link students. removed from
between the [Link] clicks on button the list of
List of Delete. students.
Students [Link] selects option Yes on
and Delete the confirmation message
Student box.
module.
25
Build Integration Testing Environment
Elements in integration test environment:
▪ Hardware and software to perform an integration
test
▪ Database environment
▪ Network environment
▪ Interface simulators
▪ Integration test cases, drivers and stubs
Integration Test Report
26
Section Questions
Which activities should be conducted for
integration testing?
What are entry/exit criteria for integration testing?
Which information should be included in an
integration test plan?
08 | Integration Testing
8.3. Strategies for Integration
Testing
Section Overview
In this section, we will review the following:
▪ Approaches/methodologies/strategies for integration
testing
• Big bang approach
• Incremental approach: top-down, bottom-up, sandwich
▪ Best practices/Guidelines
29
Guiding Questions
Big bang approach: What does it mean? What are
advantages and disadvantages of this approach?
Top-down approach: What does it mean? How does
it performed? What are advantages and disadvantages
of this approach?
Bottom-up approach: What does it mean? How does
it performed? What are advantages and disadvantages
of this approach?
Sandwich approach: What does it mean? What are
advantages and disadvantages of this approach?
30
Big Bang Approach
Introduction
▪ Considers the whole system as a subsystem.
Login
▪ Tests all the modules in a single test session.
▪ Only one integration testing session.
List of
Advantages students
▪ Low resources requirement
▪ Does not require extra coding
Add Delete
▪ Suitable for small systems Students Students
Disadvantages
▪ Wait for all modules developed.
▪ Difficult to trace root cause of bugs
▪ Hard to create test cases
31
Top-down Integration Approach
Top-down integration testing is an incremental
approach to construction of the software architecture.
Modules subordinate (and ultimately subordinate) to
the main control (main program) module are
incorporated into the structure in either a depth-first
or breadth-first manner.
32
Top-down Integration – Depth-first
3 3’
1. M1 M2 M5 M8 or M1 M2 M6
2. M1 M3 M7
3. M1 M4
33
Top-down Integration – Breadth-first
1. M2 M3 M4
2. M5 M6 M7
3. and so on, follows
34
Steps for Top-down Integration
1. The main control module is used as a test driver and stubs
are substituted for all components directly subordinate to
the main control module.
2. Depending on the integration approach selected (i.e.,
depth or breadth first), subordinate stubs are replaced one
at a time with actual components.
3. Tests are conducted as each component is integrated.
4. On completion of each set of tests, another stub is
replaced with the real component.
5. Regression testing may be conducted to ensure that new
errors have not been introduced.
35
Steps for Top-down Integration
TOP-DOWN
Login
List of
Stub
students
2 3
Add Delete
Students Students
Figure 13.2 – Top-down integration approach
36
Top-down Integration Approach
Advantages
▪ Fault localization is easier.
▪ Possibility to obtain an early prototype.
▪ Critical modules are tested on priority; major design flaws
could be found and fixed first.
Disadvantages
▪ Throw-away code programming
▪ Late interaction tests between the main program, the
application layer and the hardware.
▪ Difficult to create test cases
37
Bottom-up Integration Approach
Bottom-up integration testing, as its name
implies, begins construction and testing with atomic
modules(i.e., components at the lowest levels in the
program structure).
By moving in an opposite direction, the parent
nodes are replaced by throw-away codes (drivers)
instead of the children.
38
Steps for Bottom-up Integration
1. Low-level components are combined into clusters
(sometimes called builds) that perform a specific
software sub-function.
2. A driver (a control program for testing) is written to
coordinate test case input and output.
3. The cluster is tested.
4. Drivers are removed and clusters are combined
moving upward in the program structure.
39
Bottom-up Integration
▪ Components are combined to form clusters 1, 2, and 3. Each of the clusters
is tested using a driver.
▪ Components in clusters 1 and 2 are subordinate to Ma.
▪ Drivers D1 and D2 are removed and the clusters are interfaced directly to Ma.
40
Steps for Bottom-up Integration
Login
List of
Driver
students
1 2
Add Delete
Students Students
BOTTOM -UP
Figure 13.3 – Bottom-up integration approach
41
Bottom-up Integration Approach
Advantages
▪ Fault localization is easier.
▪ No time is wasted waiting for all modules to be developed
unlike Big-bang approach
▪ Less throw-away code programming
Disadvantages
▪ Critical modules (at the top level of software architecture)
which control the flow of application are tested last and
may be prone to defects.
▪ Early prototype is not possible
▪ Late to identify design errors
42
Sandwich Integration Approach
Sandwich integration testing combines top-down
approach and bottom-up approach.
Generally, higher level modules use a top-down
approach (stub)
Normally, lower level modules use a bottom-up
approach (driver)
Testing converges to the middle
43
Sandwich Integration Approach
TOP-DOWN
Login
List of
students
Add Delete
Students Students
BOTTOM -UP
Figure 13.4 – Sandwich integration approach
44
Sandwich Integration Approach
Advantages
▪ Top and bottom layers can be done in parallel
▪ Integration is done as soon a component is implemented
▪ Less stubs and drivers needed
▪ Easy to construct test cases
Disadvantages
▪ Still requires throw-away code programming
▪ Partial big bang integration
▪ Hard to isolate problems
45
Best Practices/Guideline
First determine the integration test strategy that
could be adopted and later prepare the test cases and
test data accordingly.
Study the architecture design of the application and
identify the critical modules. These need to be tested
on priority.
Obtain the interface designs from the architectural
team and create test cases to verify all of the
interfaces in detail. Interface to database/external
hardware/software application must be tested in
detail.
46
Best Practices/Guideline
Always have the mock data prepared, prior to
executing. Do not select test data while executing the
test cases.
Key units should be integrated first, key units may be:
▪ Functional units of the system.
▪ Units with close relationships with others
Ensure the defects get fixed without side-effects.
Report integration test defects and store the defect
reports.
47
Section Questions
What does big bang integration mean?
What are advantages and disadvantages of big
bang integration approach?
What does top-down integration mean?
What are the steps for top-down integration?
What problems may be encountered when top-
down integration is chosen?
Section Questions
What does bottom-up integration mean?
What are the steps for bottom-up integration?
What are advantages and disadvantages of
bottom-up approach?
What does sandwich integration mean?
What are advantages and disadvantages of
sandwich approach?
Summary
Integration Testing means testing in which software
components are combined and tested to evaluate
the interaction between them.
Strategies of Integration Testing
▪ Big-bang integration approach
▪ Top-down integration approach
▪ Bottom-up integration approach
▪ Sandwich integration approach
50
References
Roger S. Pressman, Software Engineering: A
Practitioner's Approach 7th edition, McGraw-Hill
Companies, Inc., 2010: Chapter 17, p.449 - p.480
Ilene Burnstein, Practical Software Testing - A
Process-Oriented Approach, Springer-Verlag New
York Inc., 2003: Chapter 6 – section 6.8
Paul C. Jorgensen, Software Testing – A Craftman’s
Approach, 2002: Chapter 13
[Link]
51
Questions & Answers
52