Chapter 8
Chapter 8
Chapter 8
Definition
Testing traditionally mean to executing program code
Software testing is done by set of people whose goal is to uncover the
defects in the product before it reaches the customer.
Basically, software testing is the process of executing software in a
controlled manner in order to answer the question “Does the software
behave as specified?”
Simply, it is the process of analyzing a program with the intent of
finding errors.
During testing, the program to be tested is executed with set of
test cases and the output of the program for the test cases is
evaluated.
The evaluation determines whether the program is performing
as expected or not.
Software testing is a complex process which cannot be done instantly.
Since testing covers 30-40% of development cost, the testing process is
carried out in 4 steps.
1. Unit Testing
2. Integration Testing
3. System Testing
4. Acceptance Testing
Unit Testing
It refers to the process of testing modules against the detailed
design specifications.
The inputs to the unit testing are the compiled success modules.
The output of unit testing is the verification of each module is
against the detail design.
In unit testing following checklist are considered.
Interface: the module interface is tested to ensure that information
properly flows into and out of the program.
Local Data Structures: the local data structure is examined to
ensure that data stored temporarily maintains its integrity.
Boundary Conditions: boundary conditions are tested to ensure
that the module operates properly to the boundaries established to limit
or restrict processing.
Error handling: finally error handling is checked to ensure
description of error, error respondents.
Procedure of Unit Testing
First of all, a review of the design information is used to guide for the
development of test cases.
Each test case should be linked with a set of anticipated results.
Driver and stub are produced for each unit test. Driver and stub are
designed to provide the complete environment for a module.
Stub Driver
A stub procedure is a dummy ● A driver module would contain
procedure that has the same the non-local data structure
input/output parameters of given accessed by the module under
procedure but has a very simplified test and would also have the
behaviour. Stub server to replace code to call the different
modules that are called by the functions of the module with
components to be tested. appropriate values.
Example
Consider a module with units: Login, Home and User
Stub:
Suppose login module is ready for test, but the two minor modules Home and User, which
are called by Login module are not ready yet for testing. At this time, a piece of dummy
code is written, which simulates the called methods of Home and User. These dummy
pieces of code are the stubs.
Driver:
Taking the same example as above. Suppose this time, the User and Home modules are
ready, but the Login module is not ready to test. Now since Home and User return values
from Login module, so a dummy piece of code is written, which simulates the Login
module. This dummy code is then called Driver.
Integration Testing
● After all the individual units have been tested, there is a need to
test how they are to be combined to prevent data loss.
● We need to ensure that one module does not have adverse impact
on another and a function perform incorrectly.
● This is where integration testing comes into play.
● Basically, integration testing is a systematic technique for
constructing the program structure while at the same time
conducting tests to uncover errors associated with interfacing
between modules.
● The primary objective is to test the module that there is no errors
in parameter passing, when one module invokes another.
● Integration testing takes as its input modules that have been unit
tested, groups them in larger aggregates, applies tests defined in an
integration test plan to those aggregates, and delivers as its output
the integrated system ready for system testing.
Approaches to Integration Testing
● Big Bang Approach
● Incremental Approach
● Top-down Integration Approach
● Bottom-up Integration Approach
● Sandwich Integration Approach
● Regression
Big Bang Approach
● In big-bang, most of the developed modules are coupled together to form
a complete software system or major part of the system and then used for
integration testing.
● This method is very effective for saving time in the integration testing
process.
● However, if the test cases and their results are not recorded properly, the
entire integration process will be more complicated and may prevent the
testing team from achieving the goal of integration testing.
● This method require near perfect unit testing because the bugs discovered
would be the defects due to component interfacing
Incremental Approach
● Each individually tested modules are integrated incrementally and
tested to ensure smooth interface and interaction between
modules.
● In this approach, every module is combined incrementally, i.e., one
by one till all modules or components are added logically to make
the required application, instead of integrating the whole system at
once and then performing testing on the end product.
● Integrated modules are tested as a group to ensure successful
integration and data flow between modules.
● Here, the primary focus of doing this testing is to check interface,
integrated links, and flow of information between modules.
● This process is repeated till the modules are combined and tested
successfully.
● Incremental approach can be further classified as
1. Top-down Incremental Testing
2. Bottom-up Incremental Testing
3. Sandwich Testing
Top Down Integration Testing
● It is a method in which integration testing takes place from top to
bottom following the control flow of software system.
● The higher level modules are tested first and then lower level
modules are tested and integrated in order to check the software
functionality.
● Stubs are used for testing if some modules are not ready.
● Depth First Search and Breadth First Search can be applied for this
purpose.
● Module: Website Login aka L
● Module: Order aka O
○ Module Order Summary aka OS
(Not yet developed)
● Module: Payment aka P
○ Module Cash Payment aka CP
○ Module Debit/Credit Payment
aka DP (Not yet developed)
○ Module Wallet Payment aka WP
(Not yet developed)
● Module: Reporting aka R (Not yet
developed)
Process Explanation
● Here, the main control module is used as test driver and stubs are
substituted for all components directly called by main module
● Depending on the strategy (DFS or BFS), subordinate stub are replaces
one at a time with actual components
● Tests are conducted as each unit is integrated
● Following test cases will be derived for “depth-first”:
○ Test Case1: Module L and Module O will be integrated and tested
Test Case2: Module L, O and OS will be integrated and tested
Test Case3: Module L, O, OS, P will be integrated and tested
Test Case4: Module L, O, OS, P, CP will be integrated and tested
Advantages Disadvantages
1. Early exposure of 1. Significant modules are
architecture defects tested late in cycle
2. It outlines the working of 2. It is very challenging to
an application as a whole write test conditions
in early stages and helps in 3. A stub is not a perfect
early disclosure of design implementation of related
defects Module. It just simulates
3. Main control points are the data flow between two
tested early modules
Bottom-Up Integration Testing
● It is a strategy in which the lower level modules are tested first.
● These tested modules are then further used to facilitate the testing
of higher level modules.
● The process continues until all modules at top level are tested.
● Once the lower level modules are tested and integrated, then the
next level of modules are formed.
Process Explanation with an example
● Modules: Rank, Marks, Percentage and Sports
Grade are not yet developed so they will be
substituted with related Driver
● Modules: Practical and Theory - integration
TU01 Check 1.Go to site http://demo.com Userid = abc User should As Pass
Customer 2.Enter UserId Password = cba Login into an Expected
Login with valid 3.Enter Password application
Data 4.Click Submit
TU02 Check 1.Go to site http://demo.com Userid = abc User should not As Pass
Customer 2.Enter UserId Password = abc Login into an Expected
Login with 3.Enter Password application
invalid Data 4.Click Submit