Você está na página 1de 57

M.C.A.

SEMESTER-V

SOFTWARE TESTING
(Journal)

PCP CENTER: CKT,PANVEL

University of Mumbai

Institute of Distance and Open Learning (IDOL)


Dr. Shankardayal Sharma bhavan, Vidyanagari, Santacruz(E)

University of Mumbai

Institute of Distance and Open Learning (IDOL)


Dr. Shankardayal Sharma bhavan, Vidyanagari, Santacruz(E)

PCP CENTER: CKT,PANVEL

Certificate
This is to certify that ________________________of T.Y. M.C.A. Semester-V has
completed the specified term work in the subject of SOFTWARE TESTING
satisfactorily within this institute as laid down by University of Mumbai during the
academic year 2016-2017

Staff Member Incharge

MCA Co-ordinator
(Prof. Anjali Kulkarni)

Examiner

INDEX
Sr.No.

Practical Description

1.

1.1 What is walk through review?


1.2 What is inspection review?

2.

2.1 Develop a Software Requirements Specification for


hospital management System.
2.2 Develop a Software Requirements
Specification for Online Ticket Booking System

3.

To generate unit testing report for Online Ticket


Booking system

4.

Perform black box testing Hotel Management system.


4.1 Using equivalence class partitioning method.
4.2 Using boundary value analysis (BVA) method

5.

Perform white box testing for Online Ticket booking


system
5.1 Using branch coverage method.
5.2 Using path coverage method
a. Control Flow Graph
b. Cyclomatic Complexity
c. Independent paths
d. Test Cases table
e. Test matrix
5.3 Using Condition coverage Method. Apply Hotel
Management system

6.

6.1 Introduction of WinRunner


6.2 Recording and Playback using WinRunner
6.3 Study GUI Checkpoints in WinRunner
6.4 Study Bitmap Checkpoints in WinRunner
6.5 Study Database Checkpoints in WinRunner
6.6 Study Text Checkpoints in WinRunner

Page No.

Date

Sign

Practical No. 2
Software Requirement Specification of Hotel Management System
Deficiency

Comments and Suggestions

There is no provision for changed rate &


customers feedback

There should be Module to show changed rate


and space for customers feedback

There was a confusion in the terms that who is


the customer and who is a employees of the
hotel.

We can use code name system for employees


of the hotel to avoid confusion.

Function Requirement
1. Reservation/Booking
1.1. The system shall record reservations.
1.2. The system shall record the customers first name.
1.3. The system shall record the customers last name.
1.4. The system shall record the number of occupants.
1.5. The system shall record the room number.
1.6. The system shall display the default room rate.
1.6.1. The system shall allow the default room rate to be changed.
1.6.2. The system shall require a comment to be entered, describing the reason for
changing the default room rate.
1.7. The system shall record the customers phone number.
1.8. The system shall display whether or not the room is guaranteed.
1.9. The system shall generate a unique confirmation number for each reservation.
1.10. The system shall automatically cancel non-guaranteed reservations if the customer has
not provided their credit card number by 6:00 pm on the check-in date.
1.11. The system shall record the expected check-in date and time.
1.12. The system shall record the expected checkout date and time.
1.13. The system shall check-in customers.
1.14. The system shall allow reservations to be modified without having to reenter all the
customer information.
1.15. The system shall checkout customers.
1.15.1. The system shall display the amount owed by the customer.
1.15.2. To retrieve customer information the last name or room number shall be used
1.15.3. The system shall record that the room is empty.
1.15.4. The system shall record the payment.
1.15.5. The system shall record the payment type.
1.16. The system shall charge the customer for an extra night if they checkout after 11:00
a.m.

1.17. The system shall mark guaranteed rooms as must pay after 6:00 pm on the check-in
date.
The system shall record customer feedback.
2. Food
2.1. The system shall track all meals purchased in the hotel (restaurant and room service).
2.2. The system shall record payment and payment type for meals.
2.3. The system shall bill the current room if payment is not made at time of service.
2.4. The system shall accept reservations for the restaurant and room service.
3. Management
3.1. The system shall display the hotel occupancy for a specified period of time (days;
including past, present, and future dates).
3.2. The system shall display projected occupancy for a period of time (days).
3.3. The system shall display room revenue for a specified period of time (days).
3.4. The system shall display food revenue for a specified period of time (days).
3.5. The system shall display an exception report, showing where default room and food
prices have been overridden.
3.6. The system shall allow for the addition of information, regarding rooms, rates, menu
items, prices, and user profiles.
3.7. The system shall allow for the deletion of information, regarding rooms, rates, menu
items, prices, and user profiles.
3.8. The system shall allow for the modification of information, regarding rooms, rates, menu
items, prices, and user profiles.
The system shall allow managers to assign user passwords

Software Requirements Specification for Online ticket booking system


.
Defects
Customer has to fill number of forms and
Information which makes the process tedious.
There is no provision for providing updates to the
customer.

Comments/Suggestion
Try to ask for only necessary information from the
customer so that the processing will be quicker.
There should be some email facilities to provide
updates to the customer.

Functional Requirements:
FR1: Allow all registered users to purchase tickets for concerts.
FR2: Allow someone to register to become a user.
FR3: The system will send out automated emails to validated users.
FR4: The user signup form should test that the form is filled in by a human and not a computer program.
FR5: Allow admin/staff users to add:
Theaters
Movies
Show Time
Cities/Towns
FR6: Allow admin/staff users to edit and delete:
Theaters
Movies
Show time
FR6: The System will allow for semi automated emails, including:
Birthday emails
Movie Update emails
FR7: The system will allow clients to search for theaters by:
City/Town
FR8: A client user should be able to edit some of their information
Contact Details
o Address
o Telephone Number
o Email address
Credit Card Details
Password
FR9: The system will allow admin/staff users to make changes to certain settings including:
Database
o Username
o Password
o Database Name
Style and Formatting, without having to edit any PHP or CSS code.
FR10: The website should be simple to use for both client and staff so that a manual is not required for
either user, although some tool tips may be required on the administration side of the site.

Practical No. 3
Unit Testing For Online Ticket Booking System

Sr. Requir
No ement
.
1 FR5

Test
Case
Id
TCI
_1

Test Case
Objective

Prereq
uisite

Descrip
tion

Input data

Expected
Output

Actual
Output

Resu
lt

A Theater
name can
be added
to the
system

Run as
applicat
ion

Enter
the
details
and
click
submit

A staff user
should be
able to add
information
into the
system.

Staff users
are able to
add
theaters to
the system

Pass

2 FR5

TCI
_2

Only
Run as
administrat applicat
ors and
ion
data entry
staff can
add
informatio
n

Enter
the
details
and
click
submit

Theater
Name Art
Centre,
Town/City
Aberystwyth,
Capacity
2500
Login name:
Test user
Password:
TestUser

only
Pass
administrat
ors and
data entry
staff can
add
information
.

3 FR6

TCI
_5

That a
movie
informatio
n can be
updated

select
movie
and
click
delete
button

4 FR6

TCI
_6

Only
Run as
administrat applicat
ors and
ion
data entry
staff can
edit
movies

Only staff
set as
administrat
ors and
data entry
staff should
be able to
gain access
to add
information
A staff user
should be
able to
update
information
about a
movie that
exists in
the system.
Only staff
set as
administrat
ors and
data entry
staff should
be able to
gain access
to edit
movies.

Run as
applicat
ion

Browse
direct
link for
edit
movies

Browse
direct link
for edit
movies

Movies
Pass
information
can be
edited.

only
administrat
ors and
data entry
staff can
edit movies

Pass

5 FR6

TCI
_7

A movie
can be
removed

Run as
applicat
ion

6 FR5

TCI
_10

A Show
Time can
be added.

Run as
applicat
ion

7 FR6

TCI
_13

A Show
Time can
be updated

Run as
applicat
ion

8 FR6

TCI
_15

A band can Run as


be
applicat
removed
ion

9 FR5

TCI
_18

A city /
town can
be added.

Run as
applicat
ion

select
movie
and
filled
out
informat
ion click
edit
button
Enter
the
details
and
click
submit

click edit
button

Select
show
time
filled
out
informat
ion and
click
edit
select
band
and
click
delete
button
Enter
the
details
and
click
submit

click edit
button

click delete
button

City/town:
Bristol

A staff user Movies can Pass


should be
be deleted.
able to
remove a
movie from
the system

A
staff/admin
user should
be able to
add
information
about a
show time
of a movie
to the
system.
A staff user
should be
able to
update a
show time
that exists
on the
system.

A Show
Time can
be added to
the
database.

Pass

A Show
time can be
updated

Pass

A staff user
should be
able to
remove a
band from
the system.
A staff user
should be
able to add
information
about a
town or a
city into
the system.

a band can
be deleted.

Pass

A city/town Pass
can be
added.

10 FR5

TCI
_19

When a
city / town
is added
all require
fields have
been filled
in

Run as
applicat
ion

click
submit

City/town:

11 FR5

TCI
_20

A city /
town
cannot be
added
twice

Run as
applicat
ion

Fill out
city/tow
n name
and
click
submit

City/town:
Bristol

12 FR6,

TCI
_24

A theater
cannot
have two
movies
booked on
the same
time.

Run as
applicat
ion

add
movies
on same
time

Movie :The
Lost World

The
concert
date

Run as
applicat
ion

a staff
user
tries to

click submit
button

13 FR5,
FR6

TCI
_26

Show Time:
3.00 p.m.5.30p.m.

If a staff
user tries to
add a city /
town and
leaves a
required
field blank
they are
returned to
the concert
form and
informed
of the error.
If a staff
user tries to
add a city
with the
same name
as another
city they
are
returned to
the concert
form and
informed
of the error.
If a staff
user tries to
add a
concert for
a movie
when one
is already
booked for
that time
they are
returned to
the Show
time form
and
informed
of the error.

all required
fields must
be filled in
before the
data is
added to
the
database.

Pass

a town or
city cannot
be added
twice.

Pass

A movie
Pass
cannot be
added if
there is
already a
booking for
that movie
on that
time.

If a staff
if the
Pass
user tries to release date
add a
is after the

cannot be
after the
release
date for
the tickets

14

FR2

TCI
_32

it is
possible
for nonmembers
of the site
to sign up
to become
a member.

Run as
applicat
ion

add a
concert
with the
ticket
release
date set
after the
concert
date
they are
returned
to the
concert
form
filled
out
details
and
click
submit
button

First Name
Mark,
Surname
Bradley,
Email
Address
mdb2@aber.
ac.uk, Date
of Birth 11
June
1984,Addres
s Line 1
108D,Addres
s Line 2
Pentre Jane
Morgan,Tow
n
Aberystwyth,
County
Ceredigion,P
ostcode
SY23
3TG,Telepho
ne Number
0132244184
8,User Name

mdb2,Passw
ord
password,Car
d Type: Card
B,Card

concert
with the
ticket
release date
set after the
concert
date they
are
returned to
the concert
form and
informed
of the error.

concert
date the
concert
will not be
added and
the user
will
returned to
the concert
form and
informed
of the error.

Upon
completion
of the
client form
the user
should be
registered
with the
site.

Test passed
users are
able to sign
up for the
site using
the client
form.

Pass

15

FR2

TCI
_34

16

FR9

TCI
_35

17

FR9

18

FR9

Number
0123987456,
Start Date:
07/2003,Expi
ry Date:
10/2008,Secu
rity Code
951
click login
The client
button
should not
be able to
sign up in
the site if
the both
passwords
do not
match.

a client is
not able to
sign up
without
the
password
in the
password
and reenter
password
fields
matching.
That a
client user
can edit
their
address
details
once they
have
signed in

Run as
applicat
ion

filled
out user
name
and
passwor
d and
click
login
button

Run as
applicat
ion

filled
out
address
info and
click
edit
button

click edit
button

TCI
_36

That a
client user
can edit
their credit
card
details
once they
have
signed in.

Run as
applicat
ion

filled
out
credit
cart
details
and
click
edit
button

click edit
button

TCI
_37

That a
Run as
client user applicat
can change ion

click
change
passwor

click change
password
button

A client
should be
able to edit
their
address
details
once they
have
logged into
the
website.
A client
should be
able to edit
their credit
card details
once they
have
logged into
the
website.
A client
should be
able to edit

Users are
able to
change
their
address
details
once they
have
logged into
the site.

Pass

Pass

Users are
able to
change
their credit
card details
once they
have
logged into
the site.

Pass

Users are
able to
change

Pass

their
password
once they
have
signed in.
19

FR8

TCI
_38

Basic
Search for
a city
returns
correct
results.

d link
and
change
passwor
d
Run as
applicat
ion

select
city and
search
concerts

click search
button

their
password
once they
have
logged into
the
website.
The user
should be
shown all
of the
concerts in
the town
selected in
the drop
down
menu.

Practical No. 4
Black box testing for Hotel management system
Using equivalence class partitioning method
Program:

their
password
once they
have
logged into
the site.
User was
Pass
shown a
list of all
concerts in
the selected
city.

#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
int amount;
cout<<"\nEnter affordable amount for a room:";
cin>>amount;
if(amount <= 2000)
cout<<"\nRegular";
else if(amount < 4000)
cout<<"\nDelux";
else
cout<<"\nSuperDelux";
getch();}

Test no.
T1.1

Pre requisite
Input values
Amount
3000
<=2000
T1.2
2001<=
4000
Amount
<=4000
T1.3
Amount <=0
-500
T1.4
Amount
4002
>=4001
T1.5
Amount
1000
>=2000
Program Number
Line number
1
12
2

NA

Expected result Actual result


Regular
Regular

Remarks
Pass

Delux

Super Delux

Fail

Error
Super Delux

Regular
Super Delux

Fail
Pass

Error

Regular

Fail

Actual Deficiencies
Delux room is
categorized as Super
Delux
Error message not
displayed on invalid
input

Required Statement
else if(amount<=4000)
if(amount <= 0 ||
amount >1000 )

Using boundary value analysis (BVA) method


#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
clrscr();
int lower = 1;
int upper = 504;
int months;
cout<<"\nEnter any number of months between 1 and 504:\n";
cin>>months;
if(months<lower || months>upper)
{
cout<<"Entered number is not in given range";
}
if(months>=1 && months <= 6)
cout<<"\nTrainee";
else if( months > 6 && months <= 36 )
cout<<"\nJunior Staff";
else if(months>36 && months <=504)
cout<<"\nSenior Staff";
getch();
}

Test cases for BVA of given program:

Test case
number

Prerequisite

Input value

Expected
result

Actual result

Remark

months=1

Trainee

Message
Trainee

Pass

months=504

504

Senior Staff

Message
Senior Staff

Pass

months=0

Not in range

Message
Entered
number is not
in given
range

Pass

months=505

505

Not in range

Message
Entered
number is not
in given
range

Pass

months=35

35

Junior staff

Message
Junior Staff

Pass

Practical No. 5
White box testing for Online Ticket booking system

Using branch coverage method


Program:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int count = 0;
char section = ; // Balcony or Upperstall
bool success;
int availableInBalcony = 50
int availableInUpperstall = 75
cout<<"\nEnter length:";
cin>> count;
cout<<"\nEnter section:";
cin>> section;
success = 0;
while(count <= 100&& count >=0)
{
if(section = Balcony)
{
if (count < = availableInBalcony )
{
availableInBalcony = availableInBalcony - count;
success = 1;
}
}
else
{
if (count < = availableInUpperstall)
{
availableInUpperstall = availableInUpperstall - count;
success = 1;
}
}
}
if (success = 1)
cout"\n Your ticket is booked successfully.;

else
cout"\n Your ticket can not be booked.;
getch();
}

Test cases for given program using branch coverage:


Test Cases:
Test Case

Input Value

Expected Output

Actual Output

Remark

Number
Count

Section

48

48

Pass

70

70

Pass

43

43

Pass

64

64

Pass

-5

MSG

MSG

Pass

102

MSG

MSG

Pass

10

33

33

Pass

34

MSG

MSG

Pass

-10

MSG

MSG

Pass

10

101

MSG

MSG

Pass

Section Notation:
B=Available Balcony
U=Available Upper Stall

MSG= Your ticket cannot be booked

Branch/Loop

Possible

Test Cases

values

Count<=100

F
Count<=B

*
*

T
F

Using Path coverage method


Program:#include<iostream.h>
#include<conio.h>
void main()

10

F
Count<=U

*
*

*
*

{
clrscr();
int charges=0;
int units=0;
int dis=0;
cout<<"\n Enter numbar of tickets :";
cin>>units;
if(units>=25)
{
dis=(500*units)/100;
charges=(units*20)-dis;
}
else
if(units>=10 && units<25)
{
dis=(200*units)/100;
charges=(units*20)-dis;
}
else
if(units>0 && units<10)
charges=units*20;
else
cout<<"\n Number of tickets entered is INVALID";
cout<<"\n Amount of bill=Rs."<<charges;
getch();
}

a) Control Flow Graph

a
IF (units>=25)

d
ELS
E
THEN

THE

IF((units>=10 &&
IF(
units>0 &&
ELSE
ELSE
units<25)

THE

e
c

g
h
i
f
ENDIF

j
ENDIF

ENDIF

b) Determine cyclomatic complexity of the control flow graph :


Cyclomatic Complexity of a graph is calculated as:
v(G) =e n + 2
Where,

e = number of edges in the graph


n=number of nodes in the graph
Here,
e=14
n=12
And hence
v(G) = 14 12 + 2
=4
c) Find out basic set of independent path
Path 1: a-d-g-i-k-l-m-n
Path 2: a-d-g-h-j-l-m-n
Path 3: a-d-e-f-m-n
Path 4: a-b-c-n

d) Prepare test cases to execute each path in basic set of


Test Cases Table
Test Case
Number

Input Values

Expected Output

Actual Output

Remark

100

100

Pass

25

375

375

Pass

10

180

180

Pass

MSG

MSG

Pass

-5

MSG

MSG

Pass

140

140

Pass

27

405

405

Pass

12

216

216

Pass

29

435

435

Pass

10

32

480

480

Pass

e) Test Matrix:

Path(e.g. 1-2-3-4-19)

Test Case Matrix

1
a,d,g,i,l,m,n

a,d,g,h,i,l,m,n
a,d,e,f,m,n

10

X
X

a,b,c,n
Using condition coverage method For Hotel Management System
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int yrs,grade,hrs,bonus; //2
printf("Enter the no of years worked : "); //3

X
X

scanf("%d", &yrs); //4


printf("\nEnter the grade : "); //5
scanf("%d", &grade); //6
printf("\nEnter the no of hours worked"); //7
scanf("%d", &hrs); //8
if(yrs > 1) //9
bonus = bonus + 10; //10
if(grade > 3) //11
bonus = bonus + 10; //12
if(hrs > 180) //13
bonus = bonus + 10; //14
getch();//15
}

Conditional Coverage:
Yrs > 1

Grade > 3

Hrs > 180

Input value
(yrs,grd,hrs)

Lines
executed

1,1,160

Possible
outcome
(bonus)
0%

1,1,185

10%

1,5,100

10%

1-9, 11,
13-15
1-9,
11-13,15

1-9, 11, 13,15

1,4,190

20%

1-9, 11-15

3,2,50

10%

1-11, 13,15

3,2,200

20%

1-11, 13-15

3,4,100

20%

1-13, 15

3,5,200

30%

1-15

Practical No. 6

To study Recording and Playback using WinRunner

SOURCE CODE:
Exercise:

1. Open paint application. Run WinRunner. Open new script. Start recording in context sensitive
recording mode. Draw anything using pencil tool in paint. Stop recording. Open new file in
paint and replay script from starting. Observe result and write detailed analysis.
Test Script:
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
button_press ("start");
# BaseBar
set_window ("BaseBar", 11);
toolbar_select_item ("ToolbarWindow32_1", "Programs;Accessories;Paint");
# untitled - Paint
set_window ("untitled - Paint", 11);
obj_mouse_drag ("Afx:1000000:8", 10, 82, 136, 100, LEFT);
obj_mouse_click ("Afx:1000000:8", 126, 77, LEFT);
obj_mouse_drag ("Afx:1000000:8", 137, 108, 164, 114, LEFT);
win_close ("untitled - Paint");
# Paint
set_window ("Paint", 5);
button_press ("No");

After Re- Running the test Script

2. Open paint application. Run WinRunner. Open new script. Start recording in analog recording
mode. Draw anything using pencil tool in paint. Stop recording. Open new file in paint and
replay script from starting. Observe result and write detailed analysis. What is difference in result of
Question 1 and Question 2?
Test Script file
# Analog Recording
move_locator_track (1);
move_locator_track (2);
mtype ("<T1547><kLeft>-<T63><kLeft>+");
move_locator_track (3);
move_locator_track (4);
mtype ("<T1093><kLeft>-<T63><kLeft>+");
move_locator_track (5);
mtype ("<T157><kLeft>-");
move_locator_track (6);
move_locator_track (7);
move_locator_track (8);
move_locator_track (9);
move_locator_track (10);
move_locator_track (11);
move_locator_track (12);
mtype ("<kLeft>+");
move_locator_track (13);
mtype ("<T109><kLeft>-<T250><kLeft>+");
move_locator_track (14);
mtype ("<kLeft>-");
move_locator_track (15);
move_locator_track (16);
mtype ("<T125><kLeft>+");
move_locator_track (17);
move_locator_track (18);
mtype ("<T313><kLeft>-<T47><kLeft>+");
move_locator_track (19);
move_locator_track (20);
mtype ("<T1141><kLeft>-");
mtype ("<T78><kLeft>+");

3. Insert code after entering agent name and before entering password to wait window for 20 seconds.
Test Script File
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 0);
button_press ("start");
# BaseBar
set_window ("BaseBar", 4);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");
# Login
set_window ("Login", 1);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
wait(20)
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
# Flight Reservation

win_close ("Flight Reservation");


The wait() function accepts 1 parameter i.e the time in seconds.
To study GUI Checkpoints in WinRunner
SOURCE CODE:
Exercise:
1. Open new script in WinRunner. Start recording in context sensitive mode. Start Flight 1A
application. Insert GUI checkpoint to check enabled property of Insert order button initially.
(Button is disabled). Type details of new order and again insert new GUI checkpoint for same
button for enabled property. (Button is enabled). Save test script. Close application Flight 1A.
Reruns saved script and analyze test result.
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 2);
button_press ("start");
# BaseBar
set_window ("BaseBar", 7);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");
# Login
set_window ("Login", 1);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
# Flight Reservation
set_window("Flight Reservation", 14);
button_check_info("Insert Order","enabled",0);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 3);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Flight Reservation
set_window ("Flight Reservation", 1);
obj_type ("MSMaskWndClass","101010");

list_select_item ("Fly From:", "Denver"); # Item Number 0;


list_select_item ("Fly To:", "London"); # Item Number 1;
obj_mouse_click ("FLIGHT", 37, 45, LEFT);
# Flights Table
set_window ("Flights Table", 0);
list_activate_item ("Flight", "20257 DEN 12:12 AM LON 07:23 PM AA
Item Number 0;

$112.20"); #

# Flight Reservation
set_window ("Flight Reservation", 7);
edit_set ("Name:", "Shrenik");
button_check_info("Insert Order","enabled",1);

2. Open application Flight 1A and observe operation of searching order. Click File->Open Order.
Verify that order can be searched by either order number or by date or by customer name or by
combination of date and customer name.
Test Script File

# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
button_press ("start");
# BaseBar
set_window ("BaseBar", 5);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");
# Login
set_window ("Login", 2);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 17);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 16);
button_set ("Order No.", ON);
button_check_info("Order No.","enabled",1);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 4);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order
set_window ("Open Order", 2);
edit_set ("Edit", "4");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 8);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 5);

button_set ("Flight Date", ON);


button_check_info("Flight Date","enabled",1);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 2);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order
set_window ("Open Order", 1);
obj_type ("MSMaskWndClass","010101");
button_press ("OK");
# Flight Reservations
set_window ("Flight Reservations", 1);
button_press ("OK");
# Open Order
set_window ("Open Order", 8);
button_press ("OK");
# Flight Reservations
set_window ("Flight Reservations", 0);
button_press ("OK");
# Open Order
set_window ("Open Order", 4);
button_set ("Customer Name", ON);
button_check_info("Customer Name","enabled",1);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order
set_window ("Open Order", 1);
edit_set ("Edit_1", "Shrenik");
button_press ("OK");
# Flight Reservations
set_window ("Flight Reservations", 0);
button_press ("OK");

# Open Order
set_window ("Open Order", 1);
button_press ("Cancel");
# Flight Reservation
win_close ("Flight Reservation");

3. Open application Flight 1B and observe operation of searching order. Click File->Open Order.
Check the operation of searching a particular operation. What are defects in searching system?
Test Script File
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
button_press ("start");

# BaseBar
set_window ("BaseBar", 5);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight

1A");
# Login
set_window ("Login", 2);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 17);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 16);
button_set ("Order No.", ON);
button_check_info("Order No.","enabled",1);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 4);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order
set_window ("Open Order", 2);
edit_set ("Edit", "4");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 8);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 5);
button_set ("Flight Date", ON);
button_check_info("Flight Date","enabled",1);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 2);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order

set_window ("Open Order", 1);


obj_type ("MSMaskWndClass","010101");
button_press ("OK");
# Flight Reservations
set_window ("Flight Reservations", 1);
button_press ("OK");
# Open Order
set_window ("Open Order", 8);
button_press ("OK");
# Flight Reservations
set_window ("Flight Reservations", 0);
button_press ("OK");
# Open Order
set_window ("Open Order", 4);
button_set ("Customer Name", ON);
button_check_info("Customer Name","enabled",1);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order
set_window ("Open Order", 1);
edit_set ("Edit_1", "Shrenik");
button_press ("OK");
# Flight Reservations
set_window ("Flight Reservations", 0);
button_press ("OK");

# Open Order
set_window ("Open Order", 1);
button_press ("Cancel");

# Flight Reservation
win_close ("Flight Reservation");

4. Open new test script file in WinRunner. Open Flight 1A application, login it. Start recording in
context sensitive mode. Go to file->open order of Filght 1A application. Insert GUI checkpoints
for order No. check box, and insert any order number and then insert GUI checkpoint for
Customer Name checkbox. Save test script with proper name. Close Flight 1A application.
Login into it. Rerun saved script for this application and observe test result.

Test Script:

# Shell_TrayWnd
set_window ("Shell_TrayWnd", 0);
button_press ("start");
# BaseBar
set_window ("BaseBar", 3);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");
# Login
set_window ("Login", 0);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
obj_type ("Password:","<kReturn>");
# Flight Reservation
set_window ("Flight Reservation", 11);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 4);
button_set ("Order No.", ON);
button_check_info("Order No.","enabled",1);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 0);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order
set_window ("Open Order", 3);
edit_set ("Edit", "4");
button_check_info("Customer Name","enabled",0);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 2);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Open Order
set_window ("Open Order", 1);

button_press ("OK");
# Flight Reservation
win_close ("Flight Reservation");

5. Open Flight 1B application and login into it. Rerun saved test script for this application. Check
test result. What are differences in test result compared to result in previous question?

To study Bitmap Checkpoints in WinRunner


SOURCE CODE:

Exercise:
Follow following step to apply bitmap checkpoint to Agent signature in Fax order form of flight
application 1A. Observe results by rerunning saved test script.
Steps:
1. Start WinRunner and open a new test.
2. Start Flight 1A application and log in.
3. Start recording in Context sensitive mode.
4. Open order number 4.
5. Open the Fax Order dialog box.
6. Enter 10 digit fax number in the fax number box.
7. Switch to Analog recording mode.
8. Sign your name in the Agent Signature box.
9. Switch back to context sensitive mode.
10. Insert a bitmap checkpoint that checks your signature.
11. Click clear signature button.
12. Insert another bitmap checkpoint that checks the Agent Signature box.
13. Click the cancel button on the fax order dialog box.
14. Stop recording.
15. Save the test.
16. Rerun test and observe result.
Test Script
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 0);
button_press ("start");
# BaseBar
set_window ("BaseBar", 3);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");
# Login
set_window ("Login", 1);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 10);
menu_select_item ("File;Open Order...");

# Open Order
set_window ("Open Order", 3);
button_set ("Order No.", ON);
edit_set ("Edit", "4");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 2);
menu_select_item ("File;Fax Order...");
# Fax Order No. 4
set_window ("Fax Order No. 4", 1);
obj_type ("MSMaskWndClass","100000000000000000");
# Analog Recording
move_locator_track (1);
move_locator_track (2);
move_locator_track (3);
mtype ("<T47><kLeft>-");
move_locator_track (4);
mtype ("<T31><kLeft>+");
move_locator_track (5);
move_locator_track (6);
mtype ("<T282><kLeft>-");
move_locator_track (7);
move_locator_track (8);
move_locator_track (9);
move_locator_track (10);
move_locator_track (11);
mtype ("<kLeft>+");
move_locator_track (12);
mtype ("<T172><kLeft>-<T156><kLeft>+");
move_locator_track (13);
mtype ("<T187><kLeft>-");
move_locator_track (14);
mtype ("<T390><kLeft>+");
move_locator_track (15);
mtype ("<T62><kLeft>-");
move_locator_track (16);
move_locator_track (17);

mtype ("<T16><kLeft>+");
move_locator_track (18);
move_locator_track (19);
mtype ("<T1859><kLeft>-<T141><kLeft>+");
move_locator_track (20);
mtype ("<T250><kLeft>-<T110><kLeft>+");
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 0);
toolbar_button_press ("ToolbarWindow32_0", "Flight Reservation"); # Button Number 3;
# Fax Order No. 4
set_window("Fax Order No. 4", 13);
obj_check_bitmap("(static)", "Img1", 1);
set_window ("Fax Order No. 4", 10);
button_press ("Clear Signature");
obj_check_bitmap("(static)", "Img2", 4);
set_window ("Fax Order No. 4", 11);
button_press ("Cancel");
# Flight Reservation
win_close ("Flight Reservation");

For Flight 1B Application

To study Database Checkpoints in WinRunner


SOURCE CODE:
Exercise:

1. Start WinRunner and open new test script.Start recording in context sensitive mode. Start Flight 1A
application. Insert one record in application Flight 1A. Apply database checkpoint (default check) to
orders table. Observe result. Save test script. Go to actual database (Program files->mercury
interactive->winnrunner->samples->flight->app->flight32.mdb) and open orders table. Delete record
with order number 10. Rerun saved script to observe mismatch.
Test Script
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
button_press ("start");
# BaseBar
set_window ("BaseBar", 3);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");
# Login
set_window ("Login", 3);
edit_set ("Agent Name:", "shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
obj_type ("Password:","<kReturn>");
# Flight Reservation
set_window ("Flight Reservation", 6);
obj_type ("MSMaskWndClass","101011");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
list_select_item ("Fly To:", "London"); # Item Number 1;
obj_mouse_click ("FLIGHT", 35, 37, LEFT);
# Flights Table
set_window ("Flights Table", 0);
list_activate_item ("Flight", "20264 DEN 12:12 AM LON 07:23 PM AA

$112.20"); #

Item Number 1;
# Flight Reservation
set_window ("Flight Reservation", 1);
edit_set ("Name:", "Shrenik");
button_press ("Insert Order");
#
# Original SQL: SELECT Orders.Order_Number FROM Orders Orders
#
db_check("list1.cdl", "dbvf1");

After Deleting a record

2. Start WinRunner and open new test script. Start recording in context sensitive mode. Start Flight 1A
application. Insert one record in application Flight 1A. Apply database checkpoint (custom check) to
orders table. Select RowCount, ColumnCount and content options while executing query. Check
test result for RowCount, Column Count and content of the table. Observe result. Save test script.
Test Script:
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 0);
button_press ("start");
# BaseBar
set_window ("BaseBar", 3);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");

# Login
set_window ("Login", 0);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
obj_type ("Password:","<kTab>");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 5);
obj_type ("MSMaskWndClass","101010");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
list_select_item ("Fly To:", "Los Angeles"); # Item Number 2;
obj_mouse_click ("FLIGHT", 55, 29, LEFT);
# Flights Table
set_window ("Flights Table", 0);
list_activate_item ("Flight", "3897 DEN 06:33 PM LAX 07:31 PM SW
Item Number 1;
# Flight Reservation
set_window ("Flight Reservation", 1);
edit_set ("Name:", "Shrenik");
button_press ("Insert Order");
#
# Original SQL: select * from orders
#
db_check("list1.cdl", "dbvf1");

$126.40"); #

After Updating a record

3. Start WinRunner and open new test script. Start recording in context sensitive mode. Start Flight 1A
application. Insert one record in application Flight 1A. Apply database checkpoint (Runtime check)
to orders table. Execute query: select orders.customer_name from orders. Check test result for
selected content of the table. Observe result. Save test script.
Test Script:
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 0);
button_press ("start");
# BaseBar
set_window ("BaseBar", 3);
toolbar_select_item ("ToolbarWindow32_1", "Programs;WinRunner;Sample Applications;Flight
1A");
# Login
set_window ("Login", 1);
edit_set ("Agent Name:", "Shrenik");
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 8);
obj_type ("MSMaskWndClass","101010");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
list_select_item ("Fly To:", "London"); # Item Number 1;
obj_mouse_click ("FLIGHT", 57, 28, LEFT);
# Flights Table
set_window ("Flights Table", 0);
list_activate_item ("Flight", "20257 DEN 12:12 AM LON 07:23 PM AA
Item Number 0;

$112.20"); #

# Flight Reservation
set_window ("Flight Reservation", 1);
edit_set ("Name:", "Shrenik");
button_press ("Insert Order");
db_record_check("list1.cvr", DVR_ONE_OR_MORE_MATCH, record_num);

To study Text Checkpoints in WinRunner

SOURCE CODE:
Exercise:

1. Start WinRunner. Start new test. Start recording in context sensitive mode. Open Flight 1A
application and log in. Open Help->About from this application menu. Insert text checkpoint
(Create->Get Text->From Object/Window) and select text Version 1.0 from opened application
window.
Insert following code to verify same text in rerun after obj_get_text() statement.

if(Version 1.0 == text)


{
report_message(Text is matched);
}
else
{
report_message(Text is not matched);
}

Você também pode gostar