2. CONCEPTS DISCUSSED
• Fundamentals of testing:
Basic Definitions, Test Cases, Identifying Test
Cases, Fault Taxonomies, Levels of Testing,
Generalized Pseudocode, The Triangle
Problem, The NextDate Function, The
Commission Problem, The SATM System, The
Currency Converter, Saturn Windshield Wiper
Controller, Garage Door Opener
7. SAMPLE QUESTION(s)
• Explain about the various terminologies
involved in understanding the basic testing
concepts.
• List out the various testing terminologies and
explain it.
• Describe the life cycle of software testing with
suitable diagram.
9. INSIGHT FROM A VENN DIAGRAM
• Software view
– Code-based view Considers what it is
– Behavioral view Considers what it does
• Testing is fundamentally concerned with behavior
• Difficulty for tester
– the base documents are usually written by and for
developers
– the emphasis is therefore on code-based, instead of
behavioral, information
10. • Consider a universe of program behaviors
• Given a program and its specification, consider
– set S specified behaviors and
– set P programmed behaviors
• PROBLEMS FACED BY TESTER
What if certain specified behaviors have not been
programmed?
– Faults of omission
What if certain programmed (implemented) behaviors
have not been specified?
–Faults of commission
12. IDENTIFYING TEST CASES
• Two fundamental approaches aka traditional
testing methods are used to identify test cases
1. Functional Testing aka Specification-based
Testing aka Black Box Testing
2. Structural Testing aka Code-based Testing
aka White Box Testing
13. • Specification-based Testing
–program can be considered to be a function
that maps values from its input domain to
values in its output range
• How test cases are identified?
–With the information used is the
specification of the software
14. • Advantage of this approach / method:
– Independent of how the software is implemented,
so if the implementation changes, the test cases are
still useful; and
– test case development can occur in parallel with
the implementation thereby reducing the overall
project development interval
• Disadvantages
– significant redundancies may exist among test
cases
– Possibility of gaps of untested software
15.
16. • Code-based Testing
– Lends itself to the definition and use of test
coverage metrics
– Test coverage metrics provide a way to explicitly
state the extent to which a software item has been
tested
19. • Process refers to how we do something
• Product end result of a process
• The point at which testing and Software Quality
Assurance (SQA) meet is that SQA typically tries to
improve the product by improving the process.
• In that sense, testing is clearly more product oriented.
20. • Faults can be classified in several ways:
–the development phase in which the
corresponding
• error occurred,
• the consequences of corresponding failures,
• difficulty to resolve,
• risk of no resolution, and so on.
• Software Anomalies “a departure from the
expected” (IEEE)
31. • Draw the dataflow diagram for a structured
triangle program implementation.
• With a neat diagram, explain the currency
converter system.
• With a neat diagram, explain the SATM
system.
SAMPLE QUESTION(S)
32. • The Triangle problem
• The NextDate function
• The Commission problem
• The Automated Teller Machine
• The Currency Converter
• The Windshield-Wiper Controller
• Garage Door Opener
33. TRIANGLE PROBLEM – PROBLEM
STATEMENT
• Simple Version: The triangle program accepts three
integers, a, b, and c, as input. These are taken to be
sides of a triangle. The output of the program is the type
of triangle determined by the three sides:
Equilateral, Isosceles, Scalene, or Not A Triangle
34. • Improved Version: “Simple version” plus better
definition of inputs: The integers a, b and c must satisfy
the following conditions:
c1: 1<=a<=200 c4: a<=b+c
c2: 1<=b<=200 c5: b<=a+c
c3: 1<=c<=200 c6: c<=a+b
39. TRIANGLE PROBLEM CONT…
Final Version: “Improved version” plus better definition of outputs: If an
input value fails any of conditions c1, c2, or c3, the program notes this
with an output message. For example:
– “Value of a is not in the range of permitted values.”
– “Value of b is not in the range of permitted values.”
– “Value of c is not in the range of permitted values.”
If values of a, b, and c satisfy conditions c1, c2, and c3, one of four
mutually exclusive outputs is given:
1. If all three sides are equal, the program output is Equilateral.
2. If exactly one pair of sides is equal, the program output is Isosceles.
3. If no pair of sides is equal, the program output is Scalene.
4. If any of conditions c4, c5, and c6 is not met, the program
output is NotATriangle.
42. PROBLEM STATEMENT
NextDate is a function of three variables: month,
date, and year.
It returns the date of the day after the input date.
The month, date, and year variables have integer
values subject to these conditions:
c1: 1<= month <=12
c2: 1<=day<=31
c3: 1812<=year<=2012
43. NEXTDATE FUNCTION – PROBLEM
STATEMENT CONT…
• If any of conditions c1, c2, or c3 fails,
NextDate produces an output indicating the
corresponding variable has an out-of-range
value.
• For example:
– “Value of month not in the range 1..12”.
– Because numerous invalid day–month–year
combinations exist, NextDate collapses these into
one message: “Invalid Input Date.”
45. LEAP YEAR
• Any year that is evenly divisible by 4 is a leap year. For example:
1988, 1992, and 1996
However, there is still a small error that must be accounted for. To
eliminate this error, the Gregorian calendar stipulates that a year that is
evenly divisible by 100 (for example, 1900) is a leap year only if it
is also evenly divisible by 400. For this reason, the following years are
not leap years:
1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600
• This is because they are evenly divisible by 100 but not by 400
The following years are leap years:1600, 2000, 2400
• This is because they are evenly divisible by both 100 and 400
46. 12 MONTHS OF THE YEAR
• The Gregorian calendar and the Julian calendar both consist of
the following twelve months:
1. January - 31 days
2. February - 28 days; 29 days in Leap Years
3. March - 31 days
4. April - 30 days
5. May - 31 days
6. June - 30 days
7. July - 31 days
8. August - 31 days
9. September - 30 days
10. October - 31 days
11. November - 30 days
12. December - 31 days
How many have 28, 30 or 31 days?
The Gregorian calendar has:
4 months with a length of 30 days
7 months that are 31 days long
February is the only month that is 28
days long in common years and 29 days
long in leap years
47.
48. Case 4: month is 2: 'February
If day < 28
Then tomorrowDay = day +1
Else
If day = 28
Then
If ((year is a leap year)
Then tomorrowDay = 29 'leap year
Else ‘not a leap year
tomorrowDay = 1
tomorrowMonth = 3
Endif
Else if day = 29
Then tomorrowDay = 1
tomorrowMonth = 3
Else Output (“Cannot have Feb”, day)
EndIf
EndIf
EndCase
Output (“Tomorrow’s date is “, tomorrowMonth, tomorrowDay, TomorrowYear)
End NextDate
49. THE COMMISSION PROBLEM
PROBLEM STATEMENT
A rifle salesperson in the former Arizona Territory sold rifle locks,
stocks, and barrels made by a gunsmith in Missouri.
Locks cost $45, stocks cost $30, and barrels cost $25.
The salesperson had to sell at least one complete rifle per month, and
production limits were such that most of the salesperson could sell in a
month was 70 locks, 80 stocks, and 90 barrels.
50. THE COMMISSION PROBLEM STATEMENT
CONT…
After each town visit, the salesperson sent a telegram to the Missouri gunsmith
with the number of locks, stocks, and barrels sold in that town.
At the end of a month, the salesperson sent a very short telegram showing –1
locks sold.
The gunsmith then knew the sales for the month were complete and computed
the salesperson’s commission as follows:
10% on sales up to (and including) $1000,
15% on the next $800, and
20% on any sales in excess of $1800
The commission program produced a monthly sales report that gave the total
number of locks, stocks, and barrels sold, the salesperson’s total dollar
sales, and, finally, the commission.
51. 10% on sales up to (and including) $1000,
15% on the next $800, and
20% on any sales in excess of $1800
Locks cost $45, stocks cost $30, and barrels
cost $25.
52. End Commission
10% on sales up to (and including) $1000,
15% on the next $800, and
20% on any sales in excess of $1800
54. SATM PROBLEM STATEMENT CONT…
• Using a terminal with features, SATM
customers can select any of the transaction
types: deposits, withdrawals, and balance
inquiries
• These transactions can be done on two types of
accounts: checking and savings
• The SATM system communicates with bank
customers via 15 screens (shown in figure)
55. SCREEN 1 – WELCOME SCREEN
• When the bank customer arrives at an SATM
station, SCREEN 1 is displayed
56. SCREEN 2 and SCREEN 4
• Bank customer accesses the SATM system with a
plastic card encoded with a Personal Account
Number (PAN) which is a key to an internal
customer account file, containing, among other
things, the customer account name and account
information
• If the customers’ PAN matches the information in
the customer account file, the system presents
screen 2 to the customer.
• If the customer’s PAN is not found, screen 4 is
displayed, and the card is kept.
57.
58. SCREEN 3 and SCREEN 5
• At Screen 2, the customer is prompted to enter his or her
Personal Identification Number (PIN)
• If the PIN is correct, the system displays Screen 5; otherwise
Screen 3 is displayed
59. SCREEN 4
• The customer has 3 chances to get the PIN
correct; after three failures, Screen 4 is
displayed, and the card is kept
60. SCREEN 6
• On entry to screen 5, the system adds two
pieces of information to the customer’s
account file, the current date and an
increment to the number of ATM sessions
• The customer selects the desired transaction
from the option shown on screen 5; then the
system immediately displays screen 6, where
the customer chooses the account to which the
selected transaction will be applied
61.
62. • If balance is requested, the system checks the
local ATM file for any unposted transactions
and reconciles these with the beginning
balance for that day from the customer account
file.
• Screen 14 is then displayed
68. PROBLEM STATEMENT
• The application converts US dollars to any of four
currencies:
– Brazilian Reals,
– Canadian Dollars,
– European Union Euros
– Japanese Yen
• Currency selection is governed by the radio buttons
which are mutually exclusive
• When a country is selected, the system responds by
completing the label; for examples, “Equivalent in…”
becomes “Equivalent in Canadian dollars” if the
Canada button is clicked
• Also, a small Canadian flag appears next to the output
position for the equivalent currency amount
69. PROBLEM STATEMENT CONT…
• Either before or after currency selection, the user inputs
an amount in US dollars
• Once both tasks are accomplished, the user can click on
the Compute button, the Clear button or Quit button
• Clicking on Compute button results in the conversion
of the US dollar amount to the equivalent amount in the
selected currency
• Clicking on the Clear button resets the currency
selection, the US dollar amount and the equivalent
currency amount and the associated label
• Clicking on the Quit button ends the application
71. • Windshield wiper is controlled by a lever with a dial
• The lever has four positions – OFF, INT (for intermittent),
LOW, and HIGH
• The dial has three positions, numbered simply 1, 2, and 3
• The dial position indicate three intermittent speeds, and
dial position is relevant only when the lever is at the INT
position
The decision table wiper speeds (in wipes per minute) for the lever and dial positions
72. PROBLEM STATEMENT CONT…
• The decision table below shows the windshield
wiper speeds (in wipes per minute) for the
lever and dial positions
74. Components :
A drive motor,
A drive chain,
The garage door wheel tracks,
A lamp, and
An electronic controller
75. A system to open a garage door is composed of several components: a drive
motor, a drive chain, the garage door wheel tracks, a lamp, and an electronic
controller. This much of the system is powered by commercial 110 V
electricity. Several devices communicate with the garage door controller—a
wireless keypad (usually in an automobile), a digit keypad on the outside of
the garage door, and a wall-mounted button. In addition, there are two safety
features, a laser beam near the floor and an obstacle sensor. These latter two
devices operate only when the garage door is closing. If the light beam is
interrupted (possibly by a pet), the door immediately stops, and then reverses
direction until the door is fully open. If the door encounters an obstacle while it
is closing (say a child’s tricycle left in the path of the door), the door stops and
reverses direction until it is fully open. There is a third way to stop a door in
motion, either when it is closing or opening. A signal from any of the three
devices (wireless keypad, digit keypad, or wall-mounted control button). The
response to any of these signals is different—the door stops in place. A
subsequent signal from any of the devices starts the door in the same direction
as when it was stopped. Finally, there are sensors that detect when the door has
moved to one of the extreme positions, either fully open or fully closed. When
the door is in motion, the lamp is lit, and remains lit for approximately 30
seconds after the door reaches one of the extreme positions.
76.
77. REFERENCE
• Paul C. Jorgensen: Software Testing, A
Craftsman’s Approach, 4th Edition, Auerbach
Publications, 2013.