Software
Engineering
Testing
Ammar Haider
Software Testing
• Testing is the process of exercising a program with
the specific intent of finding errors prior to delivery
to the end user.
2
What Testing Shows
errors
requirements conformance
performance
an indication
of quality
Who Tests the Software?
developer independent tester
Understands the system Must learn about the system,
but, will test "gently" but, will attempt to break it
and, is driven by "delivery" and, is driven by “quality”
Strategic Approach
• To perform effective testing, you should conduct effective
technical reviews.
• By doing this, many errors will be eliminated before testing
commences.
• Different testing techniques are appropriate for different
software engineering approaches and at different points in
time.
• Testing is conducted by the developer of the software and (for
large projects) an independent test group.
• Testing and debugging are different activities, but debugging
must be accommodated in any testing strategy.
5
Strategic Approach
• We begin by ʻtesting-in-the-smallʼ and move toward
ʻtesting-in-the-largeʼ
• For conventional software
The module (component) is our initial focus
Integration of modules follows
• For OO software
our focus when “testing in the small” changes from an
individual module (the conventional view) to an OO
class that encompasses attributes and operations and
implies communication and collaboration
6
V&V
• Verification refers to the set of tasks that ensure that
software correctly implements a specific function.
• Validation refers to a different set of tasks that
ensure that the software that has been built is
traceable to customer requirements.
• Boehm [Boe81] states this another way:
Verification: "Are we building the product right?"
Validation: "Are we building the right product?"
7
Testing Strategy
8
Testing Principles
• All tests should be traceable to customer
requirements
• Tests should be planned long before testing begins
• Testingshould begin “in the small” and progress
toward testing “in the large”
• Tobe most effective, testing should be conducted
by an independent third party
What is Static Testing?
• Static Testing is type of testing in which the code is
not executed. It can be done manually or by a set of
tools.
• This type of testing checks the code, requirement
documents and design documents and puts review
comments on the work document.
What is Static Testing?
• It starts earlier in development life cycle and hence
it is also called verification testing.
• Static testing can be done on work documents like
requirement specifications, design documents,
source code, test plans, test scripts and test cases,
web page content.
The Static test techniques
include:
• Informal Reviews: This is one of the type of review which doesn't
follow any process to find errors in the document. Under this
technique, you just review the document and give informal comments
on it.
• Technical Reviews: A team consisting of your peers, review the
technical specification of the software product and checks whether it
is suitable for the project. They try to find any discrepancies in the
specifications and standards followed. This review concentrates
mainly on the technical documentation related to the software such as
Test Strategy, Test Plan and requirement specification documents.
The Static test techniques
include:
• Walkthrough: The author of the work product explains the product to
his team. Participants can ask questions if any. A meeting is led by
the author. Scribe makes note of review comments.
• Inspection: The main purpose is to find defects and meeting is led by
a trained moderator. This review is a formal type of review where it
follows a strict process to find the defects. Reviewers have a checklist
to review the work [Link] record the defect and inform the
participants to rectify those errors.
• Static code Review: This is a systematic review of the software
source code without executing the code. It checks the syntax of the
code, coding standards, code optimization, etc. This is also termed as
white box [Link] review can be done at any point during
development.
What is Dynamic Testing?
• Dynamic testing is done when the code is in
operation mode.
• Dynamic testing is performed in runtime
environment.
• When the code being executed is input with a value,
the result or the output of the code is checked and
compared with the expected output.
What is Dynamic Testing?
• With this we can observe the functional behavior of
the software, monitor the system memory, CPU
response time, performance of the system.
• Dynamic testing is also known as validation testing ,
evaluating the finished product.
Types of Dynamic Testing
techniques are as follows:
• Unit Testing: Testing of individual modules by
developers.. The source code is tested in it.
• Integration Testing: Testing the interface between
different modules then they are joined.
Types of Dynamic Testing
techniques are as follows:
• System Testing: Testing performed on the system
as a whole.
• Acceptance Testing: Testing done from user point
of view at user’s end.
Static Testing Dynamic Testing Static Testing Dynamic Testing
Testing was done Testing is done by Static testing covers Dynamic testing
without executing executing the the structural and covers the executable
the program program statement coverage file of the code
testing
This testing does the Dynamic testing
verification process does the validation Cost of finding defects Cost of finding and
process and fixing is less fixing defects is high
Static testing is Dynamic testing is
about prevention of about finding and Return on investment Return on investment
defects fixing the defects will be high as this will be low as this
Static testing gives Dynamic testing process involved at an process involves after
an assessment of gives early stage the development
code and bugs/bottlenecks in phase
documentation the software system. More reviews More defects are
Static testing Dynamic testing comments are highly highly recommended
involves a checklist involves test cases recommended for for good quality.
and process to be for execution good quality
followed Requires loads of Comparatively
This testing can be Dynamic testing is meetings requires lesser
performed before
compilation
performed after
compilation
meetings 18
19
White box vs. Black box Testing
• Software is tested from two different
perspectives:
1. internal program logic is exercised
using “white box” test case design
techniques.
2. Software requirements are exercised
using “black box” test case design
techniques
Black Box Testing
• Tests the software's functionality without looking at the internal
code.
• Focuses on inputs and outputs.
• Techniques:
• Equivalence Partitioning: Divides input data into equivalent
classes.
• Boundary Value Analysis: Tests values at the boundaries of input
ranges.
• Decision Table Testing: Creates tables to represent different
combinations of inputs and outputs.
• State Transition Testing: Tests the system's behavior in different
states.
• Advantages:
• Simulates real-world user behavior.
• Can be performed by testers without programming knowledge.
• Disadvantages: 21
White Box Testing
• Tests the software's internal structure and logic.
• Requires knowledge of the code.
• Techniques:
• Statement Coverage: Ensures that every line of code is
executed at least once.
• Branch Coverage: Ensures that every branch of code is
executed at least once.
• Path Coverage: Ensures that every possible path through
the code is executed.
• Data Flow Coverage: Tracks the flow of data through the
code.
• Advantages:
• Can detect hidden bugs and optimize code.
• Provides in-depth code coverage.
• Disadvantages:
• Requires programming knowledge. 22
Black Box vs. White Box Testing
Black Box White Box
Feature Testing Testing
Focus Functionality Internal structure
Knowledge
Required Minimal In-depth
Based on
Test Design specifications Based on code
Test Cases Fewer More
Time Less More
Cost Less More 23
When to Use Which
• Black Box Testing:
• Early stages of testing.
• When time and resources are limited.
• When testing from a user's perspective.
• White Box Testing:
• Later stages of testing.
• When code coverage is critical.
• When optimizing code performance.
24
Helping Material
• [Link]
[Link]
• [Link]
g-and-dynamic-testing/
• [Link]
25