Software Testing
Why Do we Test.?
To make a judgment about quality or
acceptability.
Discover Problems
Check whether all
specifications(Requirements) are met or not?
Software Testing
It is a method to check whether the actual
software product matches the expected
requirements and to ensure that software
product is defect free.
The purpose of software testing is to identify
errors, gaps or missing requirements in
contrast to actual requirements.
Importance of Software Testing
Software Testing is important because if
there are any errors or bugs in the software it
can be identified early and can be solved
before the delivery of the software product.
Properly tested software ensures reliability,
security, high performance which further in
time saving, cost effectiveness and customer
satisfaction.
Basic Definitions
Error(mistake): Mistakes done in the program
while coding by which developer cant compile
the program.
Fault(defect):It is a condition that causes a
system to fail in performing its required
functionality.
Failure: Once the software is ready to use ,end
user is using it but the end user is facing some
issues in the production then it is said to be
failure.
Incident: Alerts user occurrence of a Failure
Basic Definitions
Incident- An incident is any situation where
the system exhibits questionable behaviour.
An incident is any event occurring where
actual results vary from expected results.
Any inconsistency between the actual output
and expected output caused by---
Test Environment issue, Issue with
developer code, Invalid expected results,
Tester mistake, Issue with test data, Issue with
hardware.
Insights from a Venn Diagram
Cont.,
Venn diagram Continues…
2,5 Specified Behaviour that are not tested
1,4 Specified behaviour that are tested
3,7 Testcase corresponding to unspecified
behaviour (They are programmed and tested
but not specified)
2,6 Programmed behaviour that are not
tested
1,3 Programmed behaviour that are tested
4,7 Test cases that are unprogrammed
behaviour.
Venn diagram Continues…
If there are specified behaviours, which are
not tested ,the testing is incomplete.
The test cases which are unspecified
behaviour such test cases are unwarranted.
If certain specified behaviour have not been
programmed then it is said as fault of
omission.
If certain programmed behaviours have not
been specified such thing is said as faults of
commission.
Venn diagram Continues…
The intersection of specified and
programmed is the correct portion,i,e
behaviour that are both specified and
implemented such testing can be said as
Good Testing.
Venn diagram Continues…
Draw the Venn diagram for the following
1. 2,4,5 are Specified behaviors
2. 3,6,8 are Programmed behaviors
3. 1,7,9 are Tested behaviors
4. 10,11, are Specified and Programmed
behaviors
5. 14,17 are Programmed and Tested
behaviors
6. 12, 13 are Specified and Tested behaviors
7. 15,16,19 are Specified ,Programmed and
tested behaviors.
Process of testing
Test planning
Test case development
Running test cases
Evaluating test results
Test Cases
Identifying Test Cases
Functional Testing( Black Box Testing):
implementation of Black box is not known.
Function of black box is understood by i/p &
o/p.
Functional Testing
Advantages
Independent of how the software is implemented.
If implementation change test cases are still useful
Test case development can occur in parallel with the
implementation.
Disadvantage:
Redundancies may exist among test cases
Possibility of gaps of untested software.
Conti.,
Structural Testing
Also called white box testing( even clear
box Testing)
Implementation (of the Black box) is known
& used to identify test cases.
Error & Fault Taxonomies
Definition of error & fault hinge on the
distinction between process & product
Process-refer to how we do something.
Product-end result of a process.
SQA- tries to improve the product by
improving the process.
Testing is clearly more product oriented.
Faults can be classified in several ways
Levels of Testing
Levels of testing echo the levels of
abstraction found in the waterfall model of
the SDLC.
In functional testing 3 levels of definition
(specification, preliminary design, detailed
design) correspond directly to 3 levels of
testing –system, integration & unit testing.
Examples
Three examples to illustrate various unit
Testing methods.
These examples raise most of the issues that
testing craftsperson's will encounter at the
unit level.
For the purpose of structural testing,
pseudocode implementation of 3 unit-level eg.
are given.
The triangle problem
NextDate
Commission problem
Generalized Psuedocode
Pseudocode provides a “language neutral”
way to express program source code.
Pseudocode given here is based on visual
basic.
Triangle Problem
Problem statement
Simple version: The triangle program accepts
3 integers a, b, c as input to be sides of a
triangle
o/p is type of triangle determined by 3 sides
Equilateral, Isosceles, Scalene, Not a
triangle.
Improved version
Sides of triangle integer a, b, c must satisfy the following conditions
One of the 4 mutually exclusive output is given
Traditional Implementation
The NextDate Function
Illustrate complexity
Logical relationship among the i/p variables
Problem statement:
NextDate is a function of 3 variables Month,
Day, Year.
It returns the date of the day after the i/p
date.
condition
Problem statement
Responses for invalid values of i/p values for
day, month, year.
Responses for invalid combination of i/p june
31 any year.
If any of the conditions C1, C2, or C3 fails
Corresponding variables has out-of-range values.
Eg. “Value of month not in range 1…12”
If invalid day-month- year combination exist
NextDate collapses these into one message
“Invalid input date”
Discussion
Two source of complexity
Complexity of input domain
Rule that determine when a year is leap year.
A year is 365.2422 days long
Leap years are used for the “extra day”
problem.
According to Gregorian calendar
A year is a leap year if it is divisible by 4, unless it is a
century year.
Century years are leap years only if they are multiples
of 400
So 1992, 1996, 2000 are leap years… 1900 is not
Implementation
Improved Version
The commission Problem
It contains a mix of computation & decision
making.
A rifle salesperson in the former Arizona
territory sold rifle lock’s, stocks, & barrel’s
made of a gunsmith in Missouri.
Locks cost $45, stocks cost $30, Barrel Cost $
25.
Sales person has to sell at least 1 complete
rifle per month
Production limitation such that 1 sales man
can sell 70 locks, 80 stocks, 90 barrels per
month.
After each town visit salesperson update sale
of no of locks, stocks, barrels through a
telegram to gunsmith
At the end of month salesperson sent a shot
telegram showing -1 locks sold.
Gunman knew sales for month are over &
compute the commission of sales person
10% on sales up to $1000
15% on the next $800
20% on any sales in excess of $1800
The commission program produces a monthly
sales report that gave total no. of locks, barrels,
stocks sold. Sales persons total dollar sale &
Discussion
This problem separates into 3 distinct pieces
The input data portion( data validation)
ignore here
Sales calculation
Commission calculation problem.
Implementation
The SATM System
To better discuss the issues of integration &
system testing
The currency converter
• Another event
driven
program that
emphasizes
code
associated
with a GUI
• A sample GUI
built with
visual basic is
shown.
Saturn Windshield Wiper Controller