Software Testing: Levels, Component Testing, Stubs, Drivers, and Unit Testing, Lecture notes of Software Engineering

The concept of software testing, focusing on the levels of testing, component testing, and unit testing. It explains the use of stubs and drivers in testing, the objectives of component testing, and the importance of unit testing. It also provides examples and differences between stubs and drivers.

Typology: Lecture notes

2020/2021

Uploaded on 07/03/2021

muhammad-haris-15
muhammad-haris-15 🇵🇰

6 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 3: Testing in Software Life Cycle
Software Testing
Lecture 5
General Levels of Testing
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Software Testing: Levels, Component Testing, Stubs, Drivers, and Unit Testing and more Lecture notes Software Engineering in PDF only on Docsity!

Chapter 3: Testing in Software Life Cycle

Software Testing

Lecture 5

General Levels of Testing

Agenda for today

Levels of Testing

Component Testing

 Stub’s and Drivers

 Unit Testing

 Points for Unit Testing

 Tools for Unit Testing

Integration Testing

 Integration Testing Approaches

 Bottom Up and Top Down integration Testing

 BigBang and Adhoc integration Testing

Component Testing

Testing of separate software component is known as component testing

Objective of component testing is to verify the input/output behavior of

the test object

A group of components is known as module testing.

The main characteristic is that the software components are tested

individually and isolated from all other software components of the

system.

The isolation is necessary to prevent external influences on components.

Most often stubs and drivers are used to replace the missing software and

simulate the interface between the software components

Test Objects, Stubs and

Driver

Test objects are program modules/units or classes, (database) scripts, and

other software components.

Drivers are the dummy programs which are used to call the functions of the

lowest module in case the calling function does not exist.

OR

 A driver calls the component to be tested.

Stubs can be referred to as code a snippet which accepts the

inputs/requests from the top module and returns the results/ response.

OR

-> A stub is called from the software component to be tested.

Component Testing:

Example

Scenario: There are two web pages. In one of the web pages there are a

many certain fields like username, address, mobile no. etc in which data

has to be entered. In the other (second) web page also there are certain

fields which carry forward the data from the first page. Testing the

functionality of these individual pages is called Component Testing.

Components are tested as soon as they are created,

There can be results retrieved from a component under test, are

dependent on other components which in turn are not developed

So in order to test that component, we use Stubs and Drivers

Stubs and Driver’s Difference

Stub

Driver

Type Dummy codes Dummy codes

Description

A piece of code that emulates

the called function.

A piece of code that emulates a

calling function.

Used in Top Down Integration Bottom Up Integration

Purpose

To allow testing of the upper

levels of the code, when the

lower levels of the code are

not yet developed.

To allow testing of the lower

levels of the code, when the

upper levels of the code are not

yet developed.

Example 2

We have 3 modules login, home, and user module in website.

Login module is ready and need to test it, but we call functions from home

and user (which is not ready)

What we will do?

Stub

For the same example if we have Home and User modules get ready and

Login module is not ready.

Driver

Unit Testing

Check individual parts functionality

Aim is to isolate each unit of the system to identify, analyze and fix the

defects

Done by developers

Reduces cost of testing

Developers can also re-use code

Facilitates changes

Example: Testing a function: whether the loop or program is working

properly or not

Points for Unit Testing

  • Functional :
    • Does code functionally perform the task?
  • Boundaries : - What are the minimum, maximum values for the function?
  • Termination:
    • What happens in the normal termination and abnormal termination?
  • Outputs: - What are the expected outputs of the function?
  • Inputs:
    • What are the expected inputs to the function?
  • Interaction: - What other modules/functions does this interact with?

Unit Testing Tools

Junit

Nunit

JMocKit

EMMA

  • PHPUnit

Integration

Testing Example

Online shopping website

One developer was assigned to develop each of the modules below.

User registration and Authentication/Login

Product Catalogue

Shopping Cart

Billing

Payment gateway integration

Shipping and Package Tracking

  • The QA Manager suggested that integration testing should be performed.

Which types of bugs found during integration Testing?

Integration Testing

Approaches

Mainly four approaches:

Top Down approach

Bottom up approach

BigBang approach

  • Adhoc approach

Bottom up Integration

Testing

Starts with testing the lowest units of the application

Gradually moving up one-by-one.

  • Drivers will be used to simulate the functionality of the missing

modules

Development and testing can be done together

Big Bang Integration

Testing

All components tested atleast once

Individual modules of the programs are not integrated until every thing

is ready.

Convenient for small systems

Saves time