Unit 2: Types and Levels of Testing
CO2 : Prepare test cases for different types and levels of testing.
Levels of Testing
Unit Testing
Unit Testing is a level of software testing where individual units/ components of a
software are tested. The purpose is to validate that each unit of the software performs as
designed.
Unit Testing is the first level of testing and is performed prior to Integration
Testing. A unit is the smallest testable part of software. It usually has one or a few
inputs and usually a single output.
It is executed by the Developer.
Unit Testing is performed by using the White Box Testing method
Example: - A function, method, Loop or statement in program is working fine.
Page 1
, Unit 2: Types and Levels of Testing
Drivers
Drivers are used in bottom-up integration testing approach.
It can simulate the behavior of upper-level module that is not integrated yet.
Drivers modules act as the temporary replacement of module and act as the actual
products.
Drivers are also used for interact with external system and usually complex than stubs.
Driver: Calls the Module to be tested.
Now suppose you have modules B and C ready but module A which calls functions from
module B and C is not ready so developer will write a dummy piece of code for module A
which will return values to module B and C. This dummy piece of code is known as driver.
Stubs
Stubs are used in top down integration testing.
It can simulate the behavior of lower-level module that are not integrated.
They are act as a temporary replacement of module and provide same output as actual
product.
When needs to intact with external system then also stubs are used.
Stub: Is called by the Module under Test.
Assume you have 3 modules, Module A, Module B and module C. Module A is ready and
we need to test it, but module A calls functions from Module B and C which are not ready,
so developer will write a dummy module which simulates B and C and returns values to
module
A. This dummy module code is known as stub.
Importance of Stubs and Drivers
Page 2
, Unit 2: Types and Levels of Testing
Page 3
CO2 : Prepare test cases for different types and levels of testing.
Levels of Testing
Unit Testing
Unit Testing is a level of software testing where individual units/ components of a
software are tested. The purpose is to validate that each unit of the software performs as
designed.
Unit Testing is the first level of testing and is performed prior to Integration
Testing. A unit is the smallest testable part of software. It usually has one or a few
inputs and usually a single output.
It is executed by the Developer.
Unit Testing is performed by using the White Box Testing method
Example: - A function, method, Loop or statement in program is working fine.
Page 1
, Unit 2: Types and Levels of Testing
Drivers
Drivers are used in bottom-up integration testing approach.
It can simulate the behavior of upper-level module that is not integrated yet.
Drivers modules act as the temporary replacement of module and act as the actual
products.
Drivers are also used for interact with external system and usually complex than stubs.
Driver: Calls the Module to be tested.
Now suppose you have modules B and C ready but module A which calls functions from
module B and C is not ready so developer will write a dummy piece of code for module A
which will return values to module B and C. This dummy piece of code is known as driver.
Stubs
Stubs are used in top down integration testing.
It can simulate the behavior of lower-level module that are not integrated.
They are act as a temporary replacement of module and provide same output as actual
product.
When needs to intact with external system then also stubs are used.
Stub: Is called by the Module under Test.
Assume you have 3 modules, Module A, Module B and module C. Module A is ready and
we need to test it, but module A calls functions from Module B and C which are not ready,
so developer will write a dummy module which simulates B and C and returns values to
module
A. This dummy module code is known as stub.
Importance of Stubs and Drivers
Page 2
, Unit 2: Types and Levels of Testing
Page 3