0% found this document useful (0 votes)
23 views72 pages

Module 1 - Class Lecture

Uploaded by

nhce.chempa2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views72 pages

Module 1 - Class Lecture

Uploaded by

nhce.chempa2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 72

PART A – UNIT 1

A Perspective on Testing, Examples: Basic definitions,


Test cases, Insights from a Venn diagram, Identifying test
cases, Error and fault taxonomies, Levels of testing.
Examples: Generalized Pseudocode, The triangle
problem, The NextDate function, The commission
problem, The SATM (Simple Automatic Teller Machine)
problem, The currency converter, Saturn windshield
wiper, Garage Door opener.
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
Types of Fault

A fault of commission occurs when we


enter something into a representation that is
incorrect.
Faults of omission occur when we fail to
enter correct information.
Of these two types, faults of omission are
more difficult to detect and resolve.
Definition

Test:
A test is the act of exercising software with
test cases.
A test has two distinct goals: to find failures
and to demonstrate correct execution.
Testing is the process of executing a
program with the intent of finding errors.
A Testing Life Cycle:

We can summarize this life cycle as follows:


The first three phases are Putting Bugs IN;
The testing phase is Finding Bugs;
The last three phases are Getting Bugs OUT.
The Fault Resolution step is another opportunity for
errors (and new faults).
The process of testing can be divided into :
1)test planning
2)test case development
3)running test cases
4)evaluating test results
SAMPLE TEST CASE
SAMPLE TEST CASE FOR A CALCULATOR
Insights from a Venn diagram

With this diagram, we can see more clearly the problems faced
by a tester. What if certain specified behaviors have not been
programmed? These are faults of omission. What if certain
programmed behaviors have not been specified? These
correspond to faults of commission
Insights from a Venn diagram
Identifying Test Cases
Two fundamental approaches are used to
identify test cases,
Functional Testing
Structural testing
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.
Functional Testing

Functional test cases have two distinct advantages:

They are independent of how the soft­ware is implemented, so if the


implementation changes, the test cases are still useful

Test case development can occur in parallel with the


implementation, thereby reducing the overall project development
interval.
Structural Testing
ERRORS AND FAULT TAXONOMIES
ERRORS AND FAULT TAXONOMIES
ERRORS AND FAULT TAXONOMIES
ERRORS AND FAULT TAXONOMIES
ERRORS AND FAULT TAXONOMIES
ERRORS AND FAULT TAXONOMIES
EXAMPLES

 The Triangle problem


 The NextDate function
 The Commission problem
 The Automated Teller Machine
 The Currency Converter
 The Windshield-Wiper Controller
 The Garage door opener
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
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
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.
FLOWCHART FOR
TRIANGLE PROBLEM
FLOWCHART FOR TRIANGLE PROBLEM
THE NEXTDATE FUNCTION
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
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.”
An example for relationship among the variables
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
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
How many have 28, 30 or 31 days?
5. May - 31 days The Gregorian calendar has:
4 months with a length of 30 days
6. June - 30 days
7 months that are 31 days long
7. July - 31 days February is the only month that is 28
days long in common years and 29 days
8. August - 31 days long in leap years
9. September - 30 days
10. October - 31 days
11. November - 30 days
12. December - 31 days
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
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.
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.
End Commission
THE SIMPLE AUTOMATIC TELLER MACHINE
(SATM)

THE SATM TERMINAL


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)
SATM Screens
SCREEN 1 – WELCOME SCREEN

When the bank customer arrives at an SATM station,


SCREEN 1 is displayed

SCREEN 1

WELCOME

PLEASE INSERT YOUR ATM


CARD FOR SERVICE
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.
SCREEN 4
SCREEN 2

INVALID
ENTER YOUR PIN
- ---
IDENTIFICATION

Your Card will be


Press Cancel if Error
retained. Please call
the bank
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

SCREEN 3 SCREEN 5

Select transaction type:


Your PIN is
incorrect. Please Balance
Deposit
try again. Withdrawal

Press Cancel if Error


SCREEN 4
The customer has 3 chances to get the PIN correct; after
three failures, Screen 4 is displayed, and the card is kept

SCREEN 4

INVALID
IDENTIFICATION

Your Card will be


retained. Please call
the bank
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
SCREEN 6
SCREEN 5

Select transaction type: Select account type:


Checking
Balance
Deposit Savings
Withdrawal
Press Cancel if Error
Press Cancel if Error
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

SCREEN 14

Your new balance is printed on


your receipt. Another
Transaction?

Yes
No
SCREEN 7
SCREEN 8

Enter amount. Withdrawals must Insufficient funds. Please enter


be increments of Rs. 100 a new amount.
____.__
----.--
Press Cancel if Error Press Cancel if Error

SCREEN 10
SCREEN 9
Machine cannot Temporarily unable to process
withdrawals. Another
dispense the amount. Transaction?

Yes
Please try again. No
SCREEN 11 SCREEN 12

Temporarily unable to process


Your balance is being deposits. Another Transaction?

updated. Please take


Yes
cash from dispenser. No

SCREEN 13 SCREEN 14

Please put envelope into


Your new balance is printed on
deposit slot. Your your receipt. Another
balance will be updated Transaction?

Yes
Press Cancel if Error. No
SCREEN 15

Please take your receipt and


ATM card.
Thank You
THE CURRENCY CONVERTER
CURRENCY CONVERTER GUI
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
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
THE WINDSHIELD WIPER
CONTROLLER
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
PROBLEM STATEMENT CONT…

The decision table below shows the windshield wiper


speeds (in wipes per minute) for the lever and dial
positions
GARAGE DOOR OPENER
Components :
A drive motor,
A drive chain,
The garage door wheel tracks,
A lamp, and
An electronic controller
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.
END OF UNIT 1

You might also like