Software Testing
Unit 1
MR. C. R. BELAVI
DEPT. OF CSE, HSIT, NIDASOSHI
Content
A perspective on Testing
Basic Definition
Test Cases
Insights from a Venn Diagram
Identifying Test Cases
Functional Testing
Structural Testing
Error & Fault Taxonomies
Level of Testing
Why Do we Test.?
To make a judgment about quality or acceptability.
Discover Problems
Basic Definitions
Error(mistake): mistake while coding-bug
Fault(defect): Result of an error
Fault of omission
Fault of commission
Failure: A failure occurs when a Fault executes.
Incident: Alerts user occurrence of a Failure
Test: concerned with errors, faults, failures,
incident
Test Case: have identity & is associated with a
program behavior. Has i/p & o/p
Process of testing
Test planning
Test case development
Running test cases
Evaluating test results
Test Cases
Insights from a Venn Diagram
Cont.,
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.
The functional VS Structural Debate
Goals of both approach is to identify test cases.
Functional testing uses only the specification to
identify test cases.
Structural testing uses the programs source
code(implementation) as the basis of test case
identification.
Cont.,
When functional test cases are executed in combination
with structural test coverage metrics twin problems
redundancies & gaps faced by functional testing can be
recognized & resolved.
Testing as a craft
When we know what kind of error we are prone to
make
If we know what kind of faults are likely to reside in
software to be tested.
We can use this to employ more appropriate test
case identification methods.
At this point testing really becomes a craft.
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 & commission.
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
Thank you ???
References
Software Testing Craftsman’s Approach-Paul C
Jorgensen.