WR Testing Tutorial

WR History
WR Integrations

WR Testing

WR Testing Process
WR Recording
WR CheckPoints
WR FunctionGen
WRGUI Spy
WR GUI Map
WR GUI Configuration
WR V User Object
WR Data Driven Test
WR Parameterization
WR TSL
Learn More...

WR Examples(Script)

WR Script1
WR Script2
WR Script3
WR Script4
WR Script5
WR Script6
WR Script7
WR Script8
WR Script9
WR Script10
WR Examples More...

WR Interview Q&As
WR Q&As1
WR Q&As2
WR Q&As3
WR Q&As4
WR Q&As5
WR Q&As6
WR Q&As7
WR Q&As8
WR Q&As9
WR Q&As10
WR Q&As More...

WR FAQ(mp3)
Listen WR FAQ1
Listen WR FAQ2
Listen WR FAQ3
Listen WR FAQ4
Listen WR FAQ5
Listen WR FAQ6
Listen WR FAQ7
Listen WR FAQ8
Listen WR FAQ9
Listen WR FAQ10
Listern More on WR
pixels

THE LARGEST SOFTWARE TESTING SITE ON THE NET

KabInfo.Net  - Full Testing Tutorials - All Free

At KabInfo.Net you will find all the Manual and Automation Testing tutorials,
from basic Testing Definition and Testing Types,Testing Methodologies to advanced  Automation Tools like, WinRunner, LoadRunner and a Test Management Tool like TestDirector.

KabInfo.Net - The Largest Enterprise Application Testers site on the Net

Best Tester:- who gets the most bugs fixed :: Smart Tester:- Balances between listening and implementing

:::                                                                                 

11.# test script for using two diffent tables
Sol:

# table is for storing departure
# and tablel is updated with arrival from static arr[] at run time
static arr[]={"#4","#2","#3"};
table = "default.xls";
tablel = "defaultl.xls";
ddt_open(tablel, DDT_MODE_READWRITE);
re = ddt_open(table, DDT_MODE_READ);
if(rc!= E_OK&&rc!= E_FILE_OPEN)
pause("Cannot open table."); ddt_get_row_count(table,table_RowCount); for(table_Row = 1; table_Row <= table_RowCount; table_Row ++)
{
ddt_set_val_by_row(tablel,table_Row,"Arrival",arr[table_Row-l]);
ddt_save(tablel);
ddt_set_row(tablel,table_Row);
ddt_set_row(table,table_Row);
# Flight Reservation
win_activate ("Flight Reservation");
set_window ("Flight Reservation", 4);
edit_set ("Date of Flight:", "12/12/12");
list_selectjtem ("Fly From:", ddt_val(table,"Departure")); # Item Number 0;
list_select_item ("Fly To:", ddt_val(tablel, "Arrival")); # Item Number 0;
obj_mouse_dick ("FLIGHT", 58, 18, LEFT);
# Flights Table
set_window ("Flights Table", 2); button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 8);
edit_set ("Name:", "harish");
button_set (ddt_val(table,"First"), ON);
button_press ("Insert Order");
set_window ("Flight Reservation", 7);
obj_mouse_click ("Button", 12, 3, LEFT);
} ddt_close(table);
ddt_close(tablel);


***************************************************************

Theory
---

1. Record a data driven test script using data driver wizard?
a. You can use the DataDriver Wizard to convert your entire script or a part of your script into a data-driven test.
For example, your test script may include recorded operations, checkpoints, and other statements that do not need to be repeated for multiple sets of data. You need to parameterize only the portion of your test script that you want to run in a loop with multiple sets of data.
To create a data-driven test:
i. If you want to turn only part of your test script into a data-driven test, first select those lines in the test script.
ii. Choose Tools > DataDriver Wizard.
iii. If you want to turn only part of the test into a data-driven test, click Cancel. Select those lines in the test script
and reopen the DataDriver Wizard. If you want to turn the entire test into a data-driven test, click next.
iv. The Use a new or existing Excel table box displays the name of the Excel file that WinRunner creates, which
stores the data for the data-driven test. Accept the default data table for this test, enter a different name for the data
table, or use
v. The browse button to locate the path of an existing data table. By default, the data table is stored in the test
folder.
vi. In the Assign a name to the variable box, enter a variable name with which to refer to the data table, or accept
the default name, "table."
vii. At the beginning of a data-driven test, the Excel data table you selected is assigned as the value of the table
variable. Throughout the scipt, only the table variable name is used. This makes it easy for you to assign a different data
table
viii. To the script at a later time without making changes throughout the script.
ix. Choose from among the following options:
1. Add statements to create a data-driven test: Automatically adds statements to run your test in a loop: sets a variable name by which to refer to the data table; adds braces ({and}), a for statement, and a ddt_get_row_count statement to your test script selection to run it in a loop while it reads from the data table; adds ddt_open and ddt_dose statements
2. To your test script to open and close the data table, which are necessary in order to iterate rows in the table. NOTE that you can also add these statements to your test script manually.
3. If you do not choose this option, you will receive a warning that your data-driven test must contain a loop and statements to open and close your data table.
4. Import data from a database: Imports data from a database. This option adds ddt_update_from_db, and ddt_save statements to your test script after the ddt_open statement.
5. NOTE that in order to import data from a database, either Microsoft Query or Data Junction must be installed on your machine. You can install Microsoft Query from the custom installation of Microsoft Office. NOTE that Data Junction is not automatically included in your WinRunner package. To purchase Data Junction, contact your Mercury Interactive representative. For detailed information on working with Data Junction, refer to the documentation in the Data Junction package.
6. Parameterize the test: Replaces fixed values in selected checkpoints and in recorded statements with parameters, using the ddt_val function, and in the data table, adds columns with variable values for the parameters. Line by line: Opens a wizard screen for each line of the selected test script, which enables you to decide whether to parameterize a particular line, and if so, whether to add a new column to the data table or use an existing column when parameterizing data.
7. Automatically: Replaces all data with ddt_val statements and adds new columns to the data table. The first argument of the function is the name of the column In the data table. The replaced data is inserted into the table.
x. The Test script line to parameterize box displays the line of the test script to parameterize. The highlighted
value can be replaced by a parameter. The Argument to be replaced box displays the argument (value) that you can replace with a parameter. You can use the arrows to select a different argument to replace.
Choose whether and how to replace the selected data:
1. Do not replace this data: Does not parameterize this data.
2. An existing column: If parameters already exist in the data table for this test, select an existing parameter from the list.
3. A new column: Creates a new column for this parameter in the data table for this test. Adds the selected data to this column of the data table. The default name for the new parameter is the logical name of the object in the selected. TSL statement above. Accept this name or assign a new name.
xi. The final screen of the wizard opens. v
1. If you want the data table to open after you close the wizard, select Show data table now.
2. To perform the tasks specified in previous screens and close the wizard, click Finish.
3. To close the wizard without making any changes to the test script, click Cancel.

12.write a test to read the price of both economy ticket and a business ticket and check whether the price difference is greater than $100......report msg..appropriately.
sol
# Flight Reservation
win_activate ("Flight Reservation");
set_window ("Flight Reservation", 6);
edit_set ("Date of Flight:", "12/12/12");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
list_select_item ("Fly To:", "Frankfurt"); # Item Number 0;
obj_mouse_click ("FLIGHT', 35, 23, LEFT);

# Flights Table
set_window ("Flights Table", 1);
button_press ("OK");

# Flight Reservation
set_window ("Flight Reservation", 6); edit__set ("Name:", "asdf");
button_set ("Business", ON);

edit_get_text("Price:",text); text =substr(text,2,length(text)); printf("%3.2f',text);
buttonset ("Economy",ON); edit_get_text("Price:",textl); textl=substr(textl,2,length(textl)); printf("%3.2f',textl);
a=text-textl;
if(a>100)
reporLmsgfdifference is > $100"); else report_msg("difference is < $100");
*************************************************************** NOTE:
Substr
extracts a substring from a string.
Syntax:
substr ( string, position [, length ]);
string A valid string expression.
position An integer that indicates the position of the first character of the substring.
The position of the first character of the string is 1, the second is 2, etc.
length Defines the number of characters (starting from position) to include in the substring.
The substr function returns a substring beginning at a specified character in the given string. If no length is specified, the evaluated substring includes all characters, from the character located at position, to the end of the string. If the length
exceeds the actual length of the string, the substring extends to the end of the string.
***************************************************************
13.Write a test to book a flight in your name and then capture the order no. and verify in the test using open order ,whether the orderno. corresponds to your name.

sol # 13
# Flight Reservation
win_activate ("Flight Reservation");
set_window ("Flight Reservation", 3);
edit_set ("Date of Flight:", "12/12/12");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
list_select_item ("Fly To:", "Frankfurt"); # Item Number 0;
obj_mouse_click ("FLIGHT1, 51, 26, LEFT);
# Flights Table
set_window ("Flights Table", 1); button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 8);
edit_set ("Name:", "harish");
button_press ("Insert Order");
wait(7);
edit_get_text("Order No:",Or_no);
set_window ("Flight Reservation", 10);
menu_selectjtem ("File;Open Order...");

# Open Order
set_window ("Open Order", 2);
button_set ("Order No.", ON);
edit_set ("Edit",Or_no);
button_press ("OK");
set__window ("Flight Reservation", 8);
edit_get_text("Name:",text);
if(text=="harish")
tl_step("my name",0,"found"); else
tl_step("my name",1,"not found");

14. write a user defined function which calculates & returns the total amount for a particular order, verify the same with that displayed on the application.
__
#assgn 14
# Flight Reservation^
win_activate ("Flight Reservation..!");
set_window ("Flight Reservation^", 1);
edit_set ("Date of Flight:", "12/12/12");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
list_selectjtem ("Fly To:", "Frankfurt".); # Item Number 0;
obj_mouse_drag ("FUGHT_1", 58, 19, 56, 16, LEFT);
# Flights Table_l
set_window ("Flights Table_l", 1); button_press ("OK");
# Flight Reservation_l
set_window ("Flight Reservation_l", 14);
edit_set ("Name:", "harish"); :
edit_set ("Tickets:", "2"); '
edit_get_text("Tickets:",ti); edit_get_text("Price:",price); edit_get_text("Total:",total);
p=substr(price,2,length(price)); total==substr(total,2,length(total));
static function check(in ti, p)
{ ■ . '
return(ti*p);
> ,.
tot=check(ti,p);
if(tot==total)
tl_step("comparing",0,"both r same"); else
tl_step("comparing",l,"both r not same");
************************************************************** NOTE:
Function parameters can be of mode in, out, or inout. For all non-array parameters, the default mode is in. The
significance of each parameter type is as follows:
in: A parameter which is assigned a value from outside the function.
out: A parameter which passes a value from inside the function.
inout: A parameter which can be assigned a value from outside the function as well as pass on a value to the outside.
A parameter designated as out or inout must be a variable name, not an expression. Only a variable can be assigned a
value in a function call, not an expression. For example, consider a function defined in the following manner:
Array parameters can be either out or inout. If no class is specified, the default inout is assumed. While variables used within a function must be explicitly declared, this is not the case for parameters.
#*************************##*********#***********************
15. Write a test to get the selected item from the flights list...pass it as parameters to an user defined function which checks the correctness of flight no.,dep time &arrival time & price.

Sol # 15

# Flight Reservation.^
win_activate ("Flight Reservation..]."); ' - *
set_window ("Flight Reservation_l", 2);
edit_set ("Date of Flight","121212");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
list_select_item ("Fly To:", "Frankfurt"); # Item Number 0;
obj_mouse_click ("FLIGHT_1", 49, 13, LEFT);
# Flights Table_l
set_window ("Flights Table_l", 5);
list_get_selected("Flight",item,number); split(item,array,""); for(i in array)
printf(array[i]);
button_press ("OK");
# Flight Reservation^
set_window ("Flight Reservation^", 16); edit_set ("Name:", "harish"); check_all(array);
static function check_all(inout array[]) {
auto fno,dt,at,p,al,dep,arr,number,dtl,atl; edit_get_text("Flight No:",fno); edit_get_text("DepartureTime:",dt); edit_get_text("Arrival Time:",at); edit_get_text("Price:",p); edit_get_text("Airlme:",al); list__get_selected("Fly From:",dep,number);
dep = toupper(substr(dep,l,3)); v
Nst_get_selected("Fly To:",arr,number); arr=toupper(substr(arr,l,3)); dtl=array[3]&" "&array[4j; atl=array[6]&" "&array[7]; if(array[l]==fno && array[2]==dep && dtl==dt && atl==at && array[5]==arr && array[8]==al && array[9]==p)
tLstep("checking",O,"equal"); else
tl_step("checking",l,"not equal");
}

16. write a test that
a. opens a graph and reads the totl number of tickets sold.
b. creates a new order for the purchase of one ticket.
c. opens the graph again and checks that the total number of tickets sold was updated.
e. reports whether the number is correct or in correct.....use if else & tl_step.

Sol:
# Flight Reservation
win_activate ("Flight Reservation");
set_window ("Flight Reservation", 2);
menu_selectjtem ("Analysis;Graphs...");
# Graph
set_window("Graph", 4); .
obj_get_text("GS_Drawing", text, 238, 202, 256, 223); # 34 .'"' v. .;.
win_activate ("Graph"); win_close ("Graph");
# Flight Reservation t
set_window ("Flight Reservation", 4);
edit_set ("Date of Flight:", "11/11/11");
list_select_item ("Fly From:", "Frankfurt"); # Item Number 1; list_select_item ("Fly To:", "Denver"); # Item Number 0;
obj_mouse_click ("FLIGHT', 41, 20, LEFT);
# Flights Table
set_window ("Flights Table", 0); button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 6); edit_set ("Name:", "harish"); button_set ("First", ON); button_press ("Insert Order"); button_wait_info("Update Order","enabled",0,10); set_window ("Flight Reservation", 7); menu_select_item ("Analysis;Graphs...");
# Graph
set_window("Graph", 5);
obj_get_text("GS_Drawing", textl, 238, 203, 255, 224); #35
report_msg(text);
report_msg(textl);
if(textl==(text+l))
report_msg("getting updated correctly");
else
report_msg("not getting correctly updated");
win_activate ("Graph");
win_close ("Graph");
*************************************************************
NOTE:
Using font expert learn the fonts you want winrunner to recognize and include all in a group. Goto settings-> general options -> text recognition and include your group.
*************************************************************
17. write a test that(hint:modify the fax order no. label.....with a regular expression)
a. opens an order.
b. opens the fax order dialogue box.
c. checks that the total is equal to the number of tickets oredered multiplied by the price per ticket.
d. reports whether the total is correct or incorrect.
e. parameterize "order no." update your table with 3 new data ...use data driver wizard.

Sol:
Static function calc(in tic,p)
{
return(tic*p); }
table = "default.xls";
re = ddt_open(table, DDT_MODE_READ); if (rc!= E_OK && re != E_FILE_OPEN) pause("Cannot open table.");
ddt_get_row_count(table,table_RowCount);
for(table_Row = 1; table_Row <= table_RowCount; table_Row
{
ddt_set_row(table,table_Row);
# Flight Reservation
#win_restore ("Flight Reservation"); set_window ("Flight Reservation", 5); menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 2); button_set ("Order No.", ON); edit_set ("Edit", ddt_val(table,"Edit")); button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 5); menu_select_item ("File;Fax Order...");
# No text was found
# Fax Order No.
set_window("Fax Order No.", 8); obj_get_text("# Tickets:", tic); obj_get_text(Ticket Price:", p); obj_get_text("Total:", tot); win_close ("Fax Order No.");
a=calc(tic,p); if(a==tot)
tl_step("total",0,"equal"); else tl_step("total",l,"not equal");
} ddt_close(table);
*************************************************************
THEORY
*************************************************************
Creating Tests Using Regular Expressions About Regular Expressions
Regular expressions enable WinRunner to identify objects with varying names or titles. You can use regular expressions in TSL statements or in object descriptions in the GUI map. For example, you can define a regular expression in the physical description of a push button so that WinRunner can locate the push button if its label changes. A regular expression is a string that specifies a complex search phrase. In most cases the string is preceded by an exclamation point (!). (In descriptions or arguments of functions where a string is expected, such as the match function, the exclamation point is not required.) By using special characters such as a period (.), asterisk (*), caret (A), and brackets ([ ]), you define the conditions of the search. For example, the string "Iwindo.*" matches both "window" and "windows".
Creating Tests Using Regular Expressions
When to Use Regular Expressions Use a regular expression when the name of a GUI object can vary each time you run a test. For example, you can use a regular expression in the following instances:
??the physical description of an object in the GUI map
??a GUI checkpoint, when evaluating the contents of an edit object or static text
object with a varying name
??a text checkpoint, to locate a varying text string using win_find_text or
object_find_text
Using a Regular Expression in an Object's Physical

 

:::

Where to Start

What does a Software Test Engineer have to know? What will the future bring?

KabInfo.Net will try to answer this, and help you become a professional Software Test Engineer, well prepared for the future.

Before you study the tutorials, Read this introduction.

:::

Quick and Easy Learning

Because time is valuable, we deliver quick and easy learning. At KabInfo.Net, you can study everything you need to learn, in an accessible and handy format.

                        "No One Is Great, And Every One Is GREAT"

K.A.Babu (2004)

:::

Testing Joke

Tester : "I Delivered a 100% Bug Free Product!"

:::

KabInfo.Net - Testing School is for self training only. We do not warrant the correctness of the content. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Logo Courtesy - Venkat Battu

KAB SEARCH

                     About KabInfo.Net
KabInfo downloads

REFERENCES
Test Case Doc
Test Plan Doc
System Req. Spec. Design Doc
Bug Report

Listen Testing


After A Bug Is Found
Integreation Testing
Quality
Software Life Cycle
Test Engineer
Types Of Testing
Unit Testing
More MP3s soon...
Quiz


Testing
Manual Testing
Automation
WinRunner
LoadRunner
TestDirector
Q.T.P
SQL
CERTIFICATION(S)
CSQA Certification
CSTE Certification
CSPM Certification
More...
TEST CASES
For Date
For Water Bottle
For Mobile Phone
For Login Form

 For Funds Transfer
For E-Mail Id
For Balloons in a Room
For ATM
Kab Interviews?

pixels  

Best Tester???