You are on page 1of 57

M.C.A.

-Semester V

M.C.A. SEMESTER-V

SOFTWARE TESTING
(Journal)

PCP CENTER: KJSIEIT, SION

University of Mumbai

Institute of Distance and Open Learning (IDOL)


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

1 Roll No:193
M.C.A.-Semester V

University of Mumbai

Institute of Distance and Open Learning (IDOL)


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

PCP CENTER: KJSIEIT, SION

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. Uday Rote)

Examiner

2 Roll No:193
M.C.A.-Semester V

INDEX

Sr.No. Practical Description Page No. Date Sign

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

3 Roll No:193
M.C.A.-Semester V

Practical No. 2

Software Requirement Specification of Hotel Management System

Deficiency Comments and Suggestions

There is no provision for changed rate & There should be Module to show changed rate
customers feedback and space for customers feedback

There was a confusion in the terms that who is We can use code name system for employees
the customer and who is a employees of the of the hotel to avoid confusion.
hotel.

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.

4 Roll No:193
M.C.A.-Semester V

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

5 Roll No:193
M.C.A.-Semester V

Software Requirements Specification for Online ticket booking system


.

Defects Comments/Suggestion
Customer has to fill number of forms and Try to ask for only necessary information from the
Information which makes the process tedious. customer so that the processing will be quicker.
There is no provision for providing updates to the There should be some email facilities to provide
customer. 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.

6 Roll No:193
M.C.A.-Semester V

Practical No. 3

Unit Testing For Online Ticket Booking System

Sr. Requir Test Test Case Prereq Descrip Input data Expected Actual Resu
No ement Case Objective uisite tion Output Output lt
. Id
1 FR5 TCI A Theater Run as Enter Theater A staff user Staff users Pass
_1 name can applicat the Name Art should be are able to
be added ion details Centre, able to add add
to the and Town/City information theaters to
system click Aberystwyth, into the the system
submit Capacity system.
2500
2 FR5 TCI Only Run as Enter Login name: Only staff only Pass
_2 administrat applicat the Test user set as administrat
ors and ion details Password: administrat ors and
data entry and TestUser ors and data entry
staff can click data entry staff can
add submit staff should add
informatio be able to information
n gain access .
to add
information
3 FR6 TCI That a Run as select A staff user Movies Pass
_5 movie applicat movie should be information
informatio ion and able to can be
n can be click update edited.
updated delete information
button about a
movie that
exists in
the system.
4 FR6 TCI Only Run as Browse Browse Only staff only Pass
_6 administrat applicat direct direct link set as administrat
ors and ion link for for edit administrat ors and
data entry edit movies ors and data entry
staff can movies data entry staff can
edit staff should edit movies
movies be able to
gain access
to edit
movies.

7 Roll No:193
M.C.A.-Semester V

5 FR6 TCI A movie Run as select click edit A staff user Movies can Pass
_7 can be applicat movie button should be be deleted.
removed ion and able to
filled remove a
out movie from
informat the system
ion click
edit
button
6 FR5 TCI A Show Run as Enter A A Show Pass
_10 Time can applicat the staff/admin Time can
be added. ion details user should be added to
and be able to the
click add database.
submit information
about a
show time
of a movie
to the
system.
7 FR6 TCI A Show Run as Select click edit A staff user A Show Pass
_13 Time can applicat show button should be time can be
be updated ion time able to updated
filled update a
out show time
informat that exists
ion and on the
click system.
edit
8 FR6 TCI A band can Run as select click delete A staff user a band can Pass
_15 be applicat band button should be be deleted.
removed ion and able to
click remove a
delete band from
button the system.
9 FR5 TCI A city / Run as Enter City/town: A staff user A city/town Pass
_18 town can applicat the Bristol should be can be
be added. ion details able to add added.
and information
click about a
submit town or a
city into
the system.

8 Roll No:193
M.C.A.-Semester V

10 FR5 TCI When a Run as click City/town: If a staff all required Pass
_19 city / town applicat submit user tries to fields must
is added ion add a city / be filled in
all require town and before the
fields have leaves a data is
been filled required added to
in field blank the
they are database.
returned to
the concert
form and
informed
of the error.
11 FR5 TCI A city / Run as Fill out City/town: If a staff a town or Pass
_20 town applicat city/tow Bristol user tries to city cannot
cannot be ion n name add a city be added
added and with the twice.
twice click same name
submit as another
city they
are
returned to
the concert
form and
informed
of the error.
12 FR6, TCI A theater Run as add Movie :The If a staff A movie Pass
_24 cannot applicat movies Lost World user tries to cannot be
have two ion on same add a added if
movies time Show Time: concert for there is
booked on 3.00 p.m.- a movie already a
the same 5.30p.m. when one booking for
time. is already that movie
booked for on that
that time time.
they are
returned to
the Show
time form
and
informed
of the error.

13 FR5, TCI The Run as a staff click submit If a staff if the Pass
FR6 _26 concert applicat user button user tries to release date
date ion tries to add a is after the

9 Roll No:193
M.C.A.-Semester V

cannot be add a concert concert


after the concert with the date the
release with the ticket concert
date for ticket release date will not be
the tickets release set after the added and
date set concert the user
after the date they will
concert are returned to
date returned to the concert
they are the concert form and
returned form and informed
to the informed of the error.
concert of the error.
form
14 FR2 TCI it is Run as filled First Name Upon Test passed Pass
_32 possible applicat out Mark, completion users are
for non- ion details Surname of the able to sign
members and Bradley, client form up for the
of the site click Email the user site using
to sign up submit Address should be the client
to become button mdb2@aber. registered form.
a member. ac.uk, Date with the
of Birth 11 site.
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

10 Roll No:193
M.C.A.-Semester V

Number
0123987456,
Start Date:
07/2003,Expi
ry Date:
10/2008,Secu
rity Code
951
15 FR2 TCI a client is Run as filled click login The client Users are Pass
_34 not able to applicat out user button should not able to
sign up ion name be able to change
without and sign up in their
the passwor the site if address
password d and the both details
in the click passwords once they
password login do not have
and re- button match. logged into
enter the site.
password
fields
matching.
16 FR9 TCI That a Run as filled click edit A client Pass
_35 client user applicat out button should be
can edit ion address able to edit
their info and their
address click address
details edit details
once they button once they
have have
signed in logged into
the
website.
17 FR9 TCI That a Run as filled click edit A client Users are Pass
_36 client user applicat out button should be able to
can edit ion credit able to edit change
their credit cart their credit their credit
card details card details card details
details and once they once they
once they click have have
have edit logged into logged into
signed in. button the the site.
website.

18 FR9 TCI That a Run as click click change A client Users are Pass
_37 client user applicat change password should be able to
can change ion passwor button able to edit change

11 Roll No:193
M.C.A.-Semester V

their d link their their


password and password password
once they change once they once they
have passwor have have
signed in. d logged into logged into
the the site.
website.
19 FR8 TCI Basic Run as select click search The user User was Pass
_38 Search for applicat city and button should be shown a
a city ion search shown all list of all
returns concerts of the concerts in
correct concerts in the selected
results. the town city.
selected in
the drop
down
menu.

Practical No. 4

Black box testing for Hotel management system


Using equivalence class partitioning method

Program:

12 Roll No:193
M.C.A.-Semester V

#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();}

13 Roll No:193
M.C.A.-Semester V

Test no. Pre requisite Input values Expected result Actual result Remarks
T1.1 Amount 3000 Regular Regular Pass
<=2000
T1.2 2001<= 4000 Delux Super Delux Fail
Amount
<=4000
T1.3 Amount <=0 -500 Error Regular Fail
T1.4 Amount 4002 Super Delux Super Delux Pass
>=4001
T1.5 Amount 1000 Error Regular Fail
>=2000
Program Number Line number Actual Deficiencies Required Statement
1 12 Delux room is else if(amount<=4000)
categorized as Super
Delux
2 NA Error message not if(amount <= 0 ||
displayed on invalid amount >1000 )
input

14 Roll No:193
M.C.A.-Semester V

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:

15 Roll No:193
M.C.A.-Semester V

Test case Prerequisite Input value Expected Actual result Remark


number result

1 months=1 1 Trainee Message Pass


Trainee

2 months=504 504 Senior Staff Message Pass


Senior Staff

3 months=0 0 Not in range Message Pass


Entered
number is not
in given
range

4 months=505 505 Not in range Message Pass


Entered
number is not
in given
range

5 months=35 35 Junior staff Message Pass


Junior Staff

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

16 Roll No:193
M.C.A.-Semester V

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.;

17 Roll No:193
M.C.A.-Semester V

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

1 2 B 48 48 Pass

2 5 U 70 70 Pass

3 5 B 43 43 Pass

4 6 U 64 64 Pass

5 -5 B MSG MSG Pass

6 102 U MSG MSG Pass

7 10 B 33 33 Pass

8 34 B MSG MSG Pass

9 -10 U MSG MSG Pass

10 101 B MSG MSG Pass

Section Notation:

B=Available Balcony

U=Available Upper Stall

18 Roll No:193
M.C.A.-Semester V

MSG= Your ticket cannot be booked

Branch/Loop Possible
Test Cases
values

1 2 3 4 5 6 7 8 9 10

Count<=100 T * * * * * *

F * * * *

Count<=B T * * * * *

F *

Count<=U T * *

F * *

Using Path coverage method

Program:-

#include<iostream.h>
#include<conio.h>
void main()
19 Roll No:193
M.C.A.-Semester V

{
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

IF (units>=25) d

20 Roll No:193
ELSE

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


THEN THEN ELSEIF(
ELSEunits>0 && units<10)
M.C.A.-Semester V

b
THE

c g

f
ENDIF k

j
ENDIF

l ENDIF m

b) Determine cyclomatic complexity of the control flow graph :

Cyclomatic Complexity of a graph is calculated as:

v(G) =e n + 2

Where,

21 Roll No:193
M.C.A.-Semester V

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 Input Values Expected Output Actual Output Remark

Number

22 Roll No:193
M.C.A.-Semester V

1 5 100 100 Pass

2 25 375 375 Pass

3 10 180 180 Pass

4 0 MSG MSG Pass

5 -5 MSG MSG Pass

6 7 140 140 Pass

7 27 405 405 Pass

8 12 216 216 Pass

9 29 435 435 Pass

10 32 480 480 Pass

e) Test Matrix:

Path(e.g. 1-2-3-4- Test Case Matrix


-19)

1 2 3 4 5 6 7 8 9 10

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

a,d,g,h,i,l,m,n X

a,d,e,f,m,n X X X

a,b,c,n X X X

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
23 Roll No:193
M.C.A.-Semester V

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 Possible Lines
(yrs,grd,hrs) outcome executed
(bonus)
F F F 1,1,160 0% 1-9, 11, 13,15

F F T 1,1,185 10% 1-9, 11,


13-15
F T F 1,5,100 10% 1-9,
11-13,15
24 Roll No:193
M.C.A.-Semester V

F T T 1,4,190 20% 1-9, 11-15

T F F 3,2,50 10% 1-11, 13,15

T F T 3,2,200 20% 1-11, 13-15

T T F 3,4,100 20% 1-13, 15

T T T 3,5,200 30% 1-15

Practical No. 6

To study Recording and Playback using WinRunner

SOURCE CODE:

Exercise:

25 Roll No:193
M.C.A.-Semester V

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

26 Roll No:193
M.C.A.-Semester V

27 Roll No:193
M.C.A.-Semester V

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>+");

28 Roll No:193
M.C.A.-Semester V

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

29 Roll No:193
M.C.A.-Semester V

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");

30 Roll No:193
M.C.A.-Semester V

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 $112.20"); #
Item Number 0;

# 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.

31 Roll No:193
M.C.A.-Semester V

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...");

32 Roll No:193
M.C.A.-Semester V

# 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
33 Roll No:193
M.C.A.-Semester V

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");

34 Roll No:193
M.C.A.-Semester V

# 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
35 Roll No:193
M.C.A.-Semester V

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

36 Roll No:193
M.C.A.-Semester V

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.

37 Roll No:193
M.C.A.-Semester V

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;

38 Roll No:193
M.C.A.-Semester V

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

# Flight Reservation
win_close ("Flight Reservation");

39 Roll No:193
M.C.A.-Semester V

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?

40 Roll No:193
M.C.A.-Semester V

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");

41 Roll No:193
M.C.A.-Semester V

# 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>+");
42 Roll No:193
M.C.A.-Semester V

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");

43 Roll No:193
M.C.A.-Semester V

44 Roll No:193
M.C.A.-Semester V

For Flight 1B Application

45 Roll No:193
M.C.A.-Semester V

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"); #

46 Roll No:193
M.C.A.-Semester V

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");

47 Roll No:193
M.C.A.-Semester V

After Deleting a record

48 Roll No:193
M.C.A.-Semester V

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");

49 Roll No:193
M.C.A.-Semester V

# 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 $126.40"); #
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");

50 Roll No:193
M.C.A.-Semester V

51 Roll No:193
M.C.A.-Semester V

After Updating a record

52 Roll No:193
M.C.A.-Semester V

53 Roll No:193
M.C.A.-Semester V

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 $112.20"); #
Item Number 0;

# 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);

54 Roll No:193
M.C.A.-Semester V

55 Roll No:193
M.C.A.-Semester V

56 Roll No:193
M.C.A.-Semester V

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);

57 Roll No:193

You might also like