Winrunner Faq
Winrunner Faq
Winrunner Faq
WINRUNNER
FREQUENTLY ASKED QUESTIONS
10/14/2008
Winrunner FAQ J Jagan Mohan
10/14/2008
Winrunner FAQ J Jagan Mohan
When WinRunner runs a test, it uses the GUI map to locate objects. It reads an
object’s description in the GUI map and then looks for an object with the same
properties in the application being tested.
5) Have you created test scripts and what is contained in the test scripts?
a) Yes I have created test scripts. It contains the statement in Mercury
Interactive’s Test Script Language (TSL). These statements appear as a test
script in a test window. You can then enhance your recorded test script, either by
typing in additional TSL functions and programming elements or by using
WinRunner’s visual programming tool, the Function Generator.
10/14/2008
Winrunner FAQ J Jagan Mohan
details all the major events that occurred during the run, such as checkpoints,
error messages, system messages, or user messages. If mismatches are
detected at checkpoints during the test run, you can view the expected results
and the actual results from the Test Results window. If a test run fails due to a
defect in the application being tested, you can report information about the defect
directly from the Test Results window. This information is sent via e-mail to the
quality assurance manager, who tracks the defect until it is fixed.
10/14/2008
Winrunner FAQ J Jagan Mohan
a) Add-Ins are used in WinRunner to load functions specific to the particular add-
in to the memory. While creating a script only those functions in the add-in
selected will be listed in the function generator and while executing the script only
those functions in the loaded add-in will be executed else WinRunner will give an
error message saying it does not recognize the function.
14) What are the reasons that WinRunner fails to identify an object on the
GUI?
a) WinRunner fails to identify an object in a GUI due to various reasons.
i. The object is not a standard windows object.
ii. If the browser used is not compatible with the WinRunner version, GUI Map
Editor will not be able to learn any of the objects displayed in the browser
window.
16) If the object does not have a name then what will be the logical name?
a) If the object does not have a name then the logical name could be the
attached text.
17) What is the different between GUI map and GUI map files?
a) The GUI map is actually the sum of one or more GUI map files. There are two
modes for organizing GUI map files.
i. Global GUI Map file: a single GUI Map file for the entire application
ii. GUI Map File per Test: WinRunner automatically creates a GUI Map file for
each test created.
b) GUI Map file is a file which contains the windows and the objects learned by
the WinRunner with its logical name and their physical description.
10/14/2008
Winrunner FAQ J Jagan Mohan
19) When you create GUI map do you record all the objects of specific
objects?
a) If we are learning a window then WinRunner automatically learns all the
objects in the window else we will we identifying those object, which are to be
learned in a window, since we will be working with only those objects while
creating scripts.
22) What is the disadvantage of loading the GUI maps through start up
scripts?
a) If we are using a single GUI Map file for the entire AUT then the memory used
by the GUI Map may be much high.
b) If there is any change in the object being learned then WinRunner will not be
10/14/2008
Winrunner FAQ J Jagan Mohan
able to recognize the object, as it is not in the GUI Map file loaded in the memory.
So we will have to learn the object again and update the GUI File and reload it.
10/14/2008
Winrunner FAQ J Jagan Mohan
28) What different actions are performed by find and show button?
a) To find a particular object in the GUI Map file in the application, select the
object and click the Show window. This blinks the selected object.
b) To find a particular object in a GUI Map file click the Find button, which gives
the option to select the object. When the object is selected, if the object has been
learned to the GUI Map file it will be focused in the GUI Map file.
29) How do you identify which files are loaded in the GUI map?
a) The GUI Map Editor has a drop down “GUI File” displaying all the GUI Map
files loaded into the memory.
30) How do you modify the logical name or the physical description of the
objects in GUI map?
a) You can modify the logical name or the physical description of an object in a
GUI map file using the GUI Map Editor.
31) When do you feel you need to modify the logical name?
a) Changing the logical name of an object is useful when the assigned logical
name is not sufficiently descriptive or is too long.
10/14/2008
Winrunner FAQ J Jagan Mohan
36) How do you copy and move objects between different GUI map files?
a) We can copy and move objects between different GUI Map files using the GUI
Map Editor. The steps to be followed are:
i. Choose Tools > GUI Map Editor to open the GUI Map Editor.
ii. Choose View > GUI Files.
iii. Click Expand in the GUI Map Editor. The dialog box expands to display two
GUI map files simultaneously.
iv. View a different GUI map file on each side of the dialog box by clicking the file
names in the GUI File lists.
v. In one file, select the objects you want to copy or move. Use the Shift key
and/or Control key to select multiple objects. To select all objects in a GUI map
file, choose Edit > Select All.
vi. Click Copy or Move.
vii. To restore the GUI Map Editor to its original size, click Collapse.
10/14/2008
Winrunner FAQ J Jagan Mohan
37) How do you select multiple objects during merging the files?
a) Use the Shift key and/or Control key to select multiple objects. To select all
objects in a GUI map file, choose Edit > Select All.
10/14/2008
Winrunner FAQ J Jagan Mohan
10/14/2008
Winrunner FAQ J Jagan Mohan
46) What is the purpose of location indicator and index indicator in GUI
map configuration?
a) In cases where the obligatory and optional properties do not uniquely identify
an object, WinRunner uses a selector to differentiate between them. Two types of
selectors are available:
i. A location selector uses the spatial position of objects.
1. The location selector uses the spatial order of objects within the window, from
the top left to the bottom right corners, to differentiate among objects with the
same description.
ii. An index selector uses a unique number to identify the object in a window.
1. The index selector uses numbers assigned at the time of creation of objects to
identify the object in a window. Use this selector if the location of objects with the
same description may change within a window.
48) What is the name of custom class in WinRunner and what methods it
applies on the custom objects?
a) WinRunner learns custom class objects under the generic “object” class.
WinRunner records operations on custom objects using obj_ statements.
49) In a situation when obligatory and optional both the properties cannot
uniquely identify an object what method WinRunner applies?
a) In cases where the obligatory and optional properties do not uniquely identify
10/14/2008
Winrunner FAQ J Jagan Mohan
51) How do you find out which is the start up file in WinRunner?
a) The test script name in the Startup Test box in the Environment tab in the
General Options dialog box is the start up file in WinRunner.
52) What are the virtual objects and how do you learn them?
a) Applications may contain bitmaps that look and behave like GUI objects.
WinRunner records operations on these bitmaps using win_mouse_click
statements. By defining a bitmap as a virtual object, you can instruct WinRunner
to treat it like a GUI object such as a push button, when you record and run tests.
b) Using the Virtual Object wizard, you can assign a bitmap to a standard object
class, define the coordinates of that object, and assign it a logical name.
To define a virtual object using the Virtual Object wizard:
i. Choose Tools > Virtual Object Wizard. The Virtual Object wizard opens. Click
Next.
10/14/2008
Winrunner FAQ J Jagan Mohan
ii. In the Class list, select a class for the new virtual object. If rows that are
displayed in the window. For a table class, select the number of visible rows and
columns. Click Next.
iii. Click Mark Object. Use the crosshairs pointer to select the area of the virtual
object. You can use the arrow keys to make precise adjustments to the area you
define with the crosshairs. Press Enter or click the right mouse button to display
the virtual object’s coordinates in the wizard. If the object marked is visible on the
screen, you can click the Highlight button to view it. Click Next.
iv. Assign a logical name to the virtual object. This is the name that appears in the
test script when you record on the virtual object. If the object contains text that
WinRunner can read, the wizard suggests using this text for the logical name.
Otherwise, WinRunner suggests virtual_object, virtual_push_button, virtual_list,
etc.
v. You can accept the wizard’s suggestion or type in a different name. WinRunner
checks that there are no other objects in the GUI map with the same name
before confirming your choice. Click Next.
10/14/2008
Winrunner FAQ J Jagan Mohan
i. GUI checkpoints verify information about GUI objects. For example, you can
check that a button is enabled or see which item is selected in a list.
ii. Bitmap checkpoints take a “snapshot” of a window or area of your application
and compare this to an image captured in an earlier version.
iii. Text checkpoints read text in GUI objects and in bitmaps and enable you to
verify their contents.
iv. Database checkpoints check the contents and the number of rows and
columns of a result set, which is based on a query you create on your database.
10/14/2008
Winrunner FAQ J Jagan Mohan
the mouse pointer to make contact with the correct elements in the window.
59) How do you maintain the document information of the test scripts?
a) Before creating a test, you can document information about the test in the
General and Description tabs of the Test Properties dialog box. You can enter the
name of the test author, the type of functionality tested, a detailed description of
the test, and a reference to the relevant functional specifications document.
60) What do you verify with the GUI checkpoint for single property and
what command it generates, explain syntax?
a) You can check a single property of a GUI object. For example, you can check
whether a button is enabled or disabled or whether an item in a list is selected.
To create a GUI checkpoint for a property value, use the Check Property dialog
box to add one of the following functions to the test script:
i. button_check_info
ii. scroll_check_info
iii. edit_check_info
iv. static_check_info
v. list_check_info
vi. win_check_info
vii. obj_check_info
10/14/2008
Winrunner FAQ J Jagan Mohan
61) What do you verify with the GUI checkpoint for object/window and what
command it generates, explain syntax?
a) You can create a GUI checkpoint to check a single object in the application
being tested. You can either check the object with its default properties or you
can specify which properties to check.
b) Creating a GUI Checkpoint using the Default Checks
i. You can create a GUI checkpoint that performs a default check on the property
recommended by WinRunner. For example, if you create a GUI checkpoint that
checks a push button, the default check verifies that the push button is enabled.
ii. To create a GUI checkpoint using default checks:
1. Choose Create > GUI Checkpoint > For Object/Window, or click the GUI
Checkpoint for Object/Window button on the User toolbar. If you are recording in
Analog mode, press the CHECK GUI FOR OBJECT/WINDOW softkey in order to
avoid extraneous mouse movements. Note that you can press the CHECK GUI
FOR OBJECT/WINDOW softkey in Context Sensitive mode as well. The
WinRunner window is minimized, the mouse pointer becomes a pointing hand,
and a help window opens on the screen.
2. Click an object.
3. WinRunner captures the current value of the property of the GUI object being
checked and stores it in the test’s expected results folder. The WinRunner
window is restored and a GUI checkpoint is inserted in the test script as an
obj_check_gui statement
10/14/2008
Winrunner FAQ J Jagan Mohan
i. Choose Create > GUI Checkpoint > For Object/Window, or click the GUI
Checkpoint for Object/Window button on the User toolbar. If you are recording in
Analog mode, press the CHECK GUI FOR OBJECT/WINDOW softkey in order to
avoid extraneous mouse movements. Note that you can press the CHECK GUI
FOR OBJECT/WINDOW softkey in Context Sensitive mode as well. The
WinRunner window is minimized, the mouse pointer becomes a pointing hand,
and a help window opens on the screen.
ii. Double-click the object or window. The Check GUI dialog box opens.
iii. Click an object name in the Objects pane. The Properties pane lists all the
properties for the selected object.
iv. Select the properties you want to check.
1. To edit the expected value of a property, first select it. Next, either click the Edit
Expected Value button, or double-click the value in the Expected Value column to
edit it.
2. To add a check in which you specify arguments, first select the property for
which you want to specify arguments. Next, either click the Specify Arguments
button, or double-click in the Arguments column. Note that if an ellipsis (three
dots) appears in the Arguments column, then you must specify arguments for a
check on this property. (You do not need to specify arguments if a default
argument is specified.) When checking standard objects, you only specify
arguments for certain properties of edit and static text objects. You also specify
arguments for checks on certain properties of nonstandard objects.
3. To change the viewing options for the properties of an object, use the Show
Properties buttons.
4. Click OK to close the Check GUI dialog box. WinRunner captures the GUI
information and stores it in the test’s expected results folder. The WinRunner
window is restored and a GUI checkpoint is inserted in the test script as an
obj_check_gui or a win_check_gui statement.
10/14/2008
Winrunner FAQ J Jagan Mohan
62) What do you verify with the GUI checkpoint for multiple objects and
what command it generates, explain syntax?
a) To create a GUI checkpoint for two or more objects:
i. Choose Create > GUI Checkpoint > For Multiple Objects or click the GUI
Checkpoint for Multiple Objects button on the User toolbar. If you are recording in
Analog mode, press the CHECK GUI FOR MULTIPLE OBJECTS softkey in order
to avoid extraneous mouse movements. The Create GUI Checkpoint dialog box
opens.
ii. Click the Add button. The mouse pointer becomes a pointing hand and a help
window opens.
iii. To add an object, click it once. If you click a window title bar or menu bar, a
help window prompts you to check all the objects in the window.
iv. The pointing hand remains active. You can continue to choose objects by
repeating step 3 above for each object you want to check.
v. Click the right mouse button to stop the selection process and to restore the
mouse pointer to its original shape. The Create GUI Checkpoint dialog box
reopens.
vi. The Objects pane contains the name of the window and objects included in
the GUI checkpoint. To specify which objects to check, click an object name in
the Objects pane. The Properties pane lists all the properties of the object. The
default properties are selected.
1. To edit the expected value of a property, first select it. Next, either click the Edit
Expected Value button, or double-click the value in the Expected Value column to
edit it.
2. To add a check in which you specify arguments, first select the property for
which you want to specify arguments. Next, either click the Specify Arguments
button, or double-click in the Arguments column. Note that if an ellipsis appears
in the Arguments column, then you must specify arguments for a check on this
10/14/2008
Winrunner FAQ J Jagan Mohan
63) What information is contained in the checklist file and in which file
expected results are stored?
a) The checklist file contains information about the objects and the properties of
the object we are verifying.
b) The gui*.chk file contains the expected results which is stored in the exp folder
64) What do you verify with the bitmap check point for object/window and
what command it generates, explain syntax?
a) You can check an object, a window, or an area of a screen in your application
as a bitmap. While creating a test, you indicate what you want to check.
WinRunner captures the specified bitmap, stores it in the expected results folder
(exp) of the test, and inserts a checkpoint in the test script. When you run the
test, WinRunner compares the bitmap currently displayed in the application being
tested with the expected bitmap stored earlier. In the event of a mismatch,
WinRunner captures the current actual bitmap and generates a difference
bitmap. By comparing the three bitmaps (expected, actual, and difference), you
can identify the nature of the discrepancy.
10/14/2008
Winrunner FAQ J Jagan Mohan
i. Choose Create > Bitmap Checkpoint > For Object/Window or click the Bitmap
Checkpoint for Object/Window button on the User toolbar. Alternatively, if you are
recording in Analog mode, press the CHECK BITMAP OF OBJECT/WINDOW
softkey. The WinRunner window is minimized, the mouse pointer becomes a
pointing hand, and a help window opens.
ii. Point to the object or window and click it. WinRunner captures the bitmap and
generates a win_check_bitmap or obj_check_bitmap statement in the script. The
TSL statement generated for a window bitmap has the following syntax:
win_check_bitmap ( object, bitmap, time );
iii. For an object bitmap, the syntax is:
obj_check_bitmap ( object, bitmap, time );
iv. For example, when you click the title bar of the main window of the Flight
Reservation application, the resulting statement might be:
win_check_bitmap ('Flight Reservation', 'Img2', 1);
v. However, if you click the Date of Flight box in the same window, the statement
might be:
obj_check_bitmap ('Date of Flight:', 'Img1', 1);
10/14/2008
Winrunner FAQ J Jagan Mohan
65) What do you verify with the bitmap checkpoint for screen area and what
command it generates, explain syntax?
a) You can define any rectangular area of the screen and capture it as a bitmap
for comparison. The area can be any size: it can be part of a single window, or it
can intersect several windows. The rectangle is identified by the coordinates of
its upper left and lower right corners, relative to the upper left corner of the
window in which the area is located. If the area intersects several windows or is
part of a window with no title (for example, a popup window), its coordinates are
relative to the entire screen (the root window).
i. Choose Create > Bitmap Checkpoint > For Screen Area or click the Bitmap
Checkpoint for Screen Area button. Alternatively, if you are recording in Analog
mode, press the CHECK BITMAP OF SCREEN AREA softkey. The WinRunner
window is minimized, the mouse pointer becomes a crosshairs pointer, and a
help window opens.
ii. Mark the area to be captured: press the left mouse button and drag the mouse
pointer until a rectangle encloses the area; then release the mouse button.
iii. Press the right mouse button to complete the operation. WinRunner captures
the area and generates a win_check_bitmap statement in your script.
iv. The win_check_bitmap statement for an area of the screen has the following
syntax:
66) What do you verify with the database checkpoint default and what
command it generates, explain syntax?
a) By adding runtime database record checkpoints you can compare the
10/14/2008
Winrunner FAQ J Jagan Mohan
information in your application during a test run with the corresponding record in
your database. By adding standard database checkpoints to your test scripts,
you can check the contents of databases in different versions of your application.
b) When you create database checkpoints, you define a query on your database,
and your database checkpoint checks the values contained in the result set. The
result set is set of values retrieved from the results of the query.
c) You can create runtime database record checkpoints in order to compare the
values displayed in your application during the test run with the corresponding
values in the database. If the comparison does not meet the success criteria you
d) specify for the checkpoint, the checkpoint fails. You can define a successful
runtime database record checkpoint as one where one or more matching records
were found, exactly one matching record was found, or where no matching
records are found.
e) You can create standard database checkpoints to compare the current values
of the properties of the result set during the test run to the expected values
captured during recording or otherwise set before the test run. If the expected
results and the current results do not match, the database checkpoint fails.
Standard database checkpoints are useful when the expected results can be
established before the test run.
Syntax: db_check(, );
f) You can add a runtime database record checkpoint to your test in order to
compare information that appears in your application during a test run with the
current value(s) in the corresponding record(s) in your database. You add
runtime database record checkpoints by running the Runtime Record Checkpoint
wizard. When you are finished, the wizard inserts the appropriate
db_record_check statement into your script.
Syntax:
db_record_check(ChecklistFileName,SuccessConditions,RecordNumber );
10/14/2008
Winrunner FAQ J Jagan Mohan
67) How do you handle dynamically changing area of the window in the
bitmap checkpoints?
a) The difference between bitmaps option in the Run Tab of the general options
defines the minimum number of pixels that constitute a bitmap mismatch
68) What do you verify with the database check point custom and what
command it generates, explain syntax?
a) When you create a custom check on a database, you create a standard
database checkpoint in which you can specify which properties to check on a
result set.
b) You can create a custom check on a database in order to:
i. check the contents of part or the entire result set
ii. edit the expected results of the contents of the result set
iii. count the rows in the result set
iv. count the columns in the result set
c) You can create a custom check on a database using ODBC, Microsoft Query
10/14/2008
Winrunner FAQ J Jagan Mohan
or Data Junction.
69) What do you verify with the sync point for object/window property and
what command it generates, explain syntax?
a) Synchronization compensates for inconsistencies in the performance of your
application during a test run. By inserting a synchronization point in your test
script, you can instruct WinRunner to suspend the test run and wait for a cue
before continuing the test.
b) You can a synchronization point that instructs WinRunner to wait for a
specified object or window to appear. For example, you can tell WinRunner to
wait for a window to open before performing an operation within that window, or
you may want WinRunner to wait for an object to appear in order to perform an
operation on that object.
c) You use the obj_exists function to create an object synchronization point, and
you use the win_exists function to create a window synchronization point. These
functions have the following syntax:
Syntax:
obj_exists ( object [, time ] );
win_exists ( window [, time ] );
70) What do you verify with the sync point for object/window bitmap and
what command it generates, explain syntax?
a) You can create a bitmap synchronization point that waits for the bitmap of an
object or a window to appear in the application being tested.
b) During a test run, WinRunner suspends test execution until the specified
bitmap is redrawn, and then compares the current bitmap with the expected one
captured earlier. If the bitmaps match, then WinRunner continues the test.
Syntax:
obj_wait_bitmap ( object, image, time );
win_wait_bitmap ( window, image, time );
10/14/2008
Winrunner FAQ J Jagan Mohan
71) What do you verify with the sync point for screen area and what
command it generates, explain syntax?
a) For screen area verification we actually capture the screen area into a bitmap
and verify the application screen area with the bitmap file during execution
Syntax: obj_wait_bitmap(object, image, time, x, y, width, height);
72) How do you edit checklist file and when do you need to edit the
checklist file?
a) WinRunner has an edit checklist file option under the create menu. Select the
“Edit GUI Checklist” to modify GUI checklist file and “Edit Database Checklist” to
edit database checklist file. This brings up a dialog box that gives you option to
select the checklist file to modify. There is also an option to select the scope of
the checklist file, whether it is Test specific or a shared one. Select the checklist
file, click OK which opens up the window to edit the properties of the objects.
10/14/2008
Winrunner FAQ J Jagan Mohan
with option to create an SQL file that uses an ODBC DSN to connect to the
database. The SQL File will contain the connection string and the SQL statement.
10/14/2008
Winrunner FAQ J Jagan Mohan
The parameter_array argument will contain the values to substitute for the
parameters in the parameterized checkpoint.
b) db_execute_query
i. to execute a query
db_execute_query ( session_name, SQL, record_number );
10/14/2008
Winrunner FAQ J Jagan Mohan
c) db_get_field_value
i. returns the value of a single field in the specified row_index and column in the
session_name database session.
d) db_get_headers
i. returns the number of column headers in a query and the content of the column
headers, concatenated and delimited by tabs.
e) db_get_row
i. returns the content of the row, concatenated and delimited by tabs.
g) db_get_last_error
i. returns the last error message of the last ODBC or Data Junction operation in
the session_name database session.
h) db_disconnect
i. disconnects from the database and ends the database session.
10/14/2008
Winrunner FAQ J Jagan Mohan
db_disconnect ( session_name );
i) db_dj_convert
i. runs the djs_file Data Junction export file. When you run this file, the Data
Junction Engine converts data from one spoke (source) to another (target). The
optional parameters enable you to override the settings in the Data Junction
export file.
82) What check points you will use to read and check text on the GUI and
explain its syntax?
a) You can use text checkpoints in your test scripts to read and check text in GUI
objects and in areas of the screen. While creating a test you point to an object or
a window containing text. WinRunner reads the text and writes a TSL statement
to the test script. You may then add simple programming elements to your test
scripts to verify the contents of the text.
10/14/2008
Winrunner FAQ J Jagan Mohan
84) Explain Get Text checkpoint from screen area with syntax?
a) We use win_get_text (window, out_text [, x1, y1, x2, y2]) function to get the
text from a window.
85) Explain Get Text checkpoint from selection (web only) with syntax?
a) Returns a text string from an object.
86) Explain Get Text checkpoint web text checkpoint with syntax?
a) We use web_obj_text_exists function for web text checkpoints.
10/14/2008
Winrunner FAQ J Jagan Mohan
string The string that is searched for. The string must be complete, contain no
spaces, and it must be preceded and followed by a space outside the quotation
marks. To specify a literal, case-sensitive string, enclose the string in quotation
marks. Alternatively, you can specify the name of a string variable. In this case,
the string variable can include a regular expression.
out_coord_array The name of the array that stores the screen coordinates of the
text (see explanation below).
10/14/2008
Winrunner FAQ J Jagan Mohan
string The text to locate. To specify a literal, case sensitive string, enclose the
string in quotation marks. Alternatively, you can specify the name of a string
variable. The value of the string variable can include a regular expression. The
regular expression should not include an exclamation mark (!), however, which is
treated as a literal character. For more information regarding Regular
Expressions, refer to the 'Using Regular Expressions' chapter in your User's
Guide.
result_array The name of the output variable that stores the location of the string
as a four-element array.
search_area The region of the object to search, relative to the window. This area
is defined as a pair of coordinates, with x1,y1,x2,y2 specifying any two diagonally
opposite corners of the rectangular search region. If this parameter is not
defined, then the entire window is considered the search area.
string The text to locate. To specify a literal, case sensitive string, enclose the
string in quotation marks. Alternatively, you can specify the name of a string
variable. The value of the string variable can include a regular expression (the
regular expression need not begin with an exclamation mark).
10/14/2008
Winrunner FAQ J Jagan Mohan
search_area The region of the object to search, relative to the window. This area
is defined as a pair of coordinates, with x1, y1, x2, y2 specifying any two
diagonally opposite corners of the rectangular search region. If this parameter is
not defined, then the entire window specified is considered the search area.
string_def Defines how the text search is performed. If no string_def is specified,
(0 or FALSE, the default parameter), the interpreter searches for a complete
word only. If 1, or TRUE, is specified, the search is not restricted to a single,
complete word.
chars2 One or more characters in the second string. These characters are
substituted for those in chars1.
89) 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
10/14/2008
Winrunner FAQ J Jagan Mohan
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.
10/14/2008
Winrunner FAQ J Jagan Mohan
driven test must contain a loop and statements to open and close your datatable.
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.
10/14/2008
Winrunner FAQ J Jagan Mohan
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.
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
10/14/2008
Winrunner FAQ J Jagan Mohan
and file name of the table. The first row in the file contains the names of the
parameters. This row is labeled row 0.
mode The mode for opening the data table: DDT_MODE_READ (read-only) or
DDT_MODE_READWRITE (read or write).
b) Ddt_save
i. Saves the information into a data file.
Syntax: dt_save (data_table_name);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table.
c) Ddt_close
i. Closes a data table file
Syntax: ddt_close ( data_table_name );
data_table_name The name of the data table. The data table is a Microsoft Excel
file or a tabbed text file. The first row in the file contains the names of the
parameters.
d) Ddt_export
i. Exports the information of one data table file into a different data table file.
Syntax: ddt_export (data_table_namename1, data_table_namename2);
e) Ddt_show
i. Shows or hides the table editor of a specified data table.
10/14/2008
Winrunner FAQ J Jagan Mohan
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table.
show_flag The value indicating whether the editor should be shown (default=1) or
hidden (0).
f) Ddt_get_row_count
i. Retrieves the no. of rows in a data tables
Syntax: ddt_get_row_count (data_table_name, out_rows_count);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters.
out_rows_count The output variable that stores the total number of rows in the
data table.
g) ddt_next_row
i. Changes the active row in a database to the next row
Syntax: ddt_next_row (data_table_name);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters.
h) ddt_set_row
10/14/2008
Winrunner FAQ J Jagan Mohan
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters. This row is labeled row 0.
i) ddt_set_val
i. Sets a value in the current row of the data table
Syntax: ddt_set_val (data_table_name, parameter, value);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters. This row is labeled row 0.
parameter The name of the column into which the value will be inserted.
value The value to be written into the table.
j) ddt_set_val_by_row
i. Sets a value in a specified row of the data table.
Syntax: ddt_set_val_by_row (data_table_name, row, parameter, value);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters. This row is labeled row 0.
row The row number in the table. It can be any existing row or the current row
10/14/2008
Winrunner FAQ J Jagan Mohan
number plus 1, which will add a new row to the data table.
parameter The name of the column into which the value will be inserted.
k) ddt_get_current_row
i. Retrieves the active row of a data table.
Syntax: ddt_get_current_row ( data_table_name, out_row );
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters. This row is labeled row 0.
out_row The output variable that stores the active row in the data table.
l) ddt_is_parameter
i. Returns whether a parameter in a datatable is valid
Syntax: ddt_is_parameter (data_table_name, parameter);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters.
m) ddt_get_parameters
i. Returns a list of all parameters in a data table.
Syntax: ddt_get_parameters ( table, params_list, params_num );
10/14/2008
Winrunner FAQ J Jagan Mohan
n) ddt_val
i. Returns the value of a parameter in the active roe in a data table.
Syntax: ddt_val (data_table_name, parameter);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters.
o) ddt_val_by_row
i. Returns the value of a parameter in the specified row in a data table.
Syntax: ddt_val_by_row ( data_table_name, row_number, parameter );
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters. This row is labeled row 0.
10/14/2008
Winrunner FAQ J Jagan Mohan
p) ddt_report_row
i. Reports the active row in a data table to the test results
Syntax: ddt_report_row (data_table_name);
data_table_name The name of the data table. The name may be the table
variable name, the Microsoft Excel file or a tabbed text file name, or the full path
and file name of the table. The first row in the file contains the names of the
parameters. This row is labeled row 0.
q) ddt_update_from_db
i. imports data from a database into a data table. It is inserted into your test script
when you select the Import data from a database option in the DataDriver
Wizard. When you run your test, this function updates the data table with data
from the database.
TSL exceptions: Instruct WinRunner to detect and handle TSL functions that
return a specific error code.
Web exceptions: When the WebTest add-in is loaded, you can instruct
WinRunner to handle unexpected events and errors that occur in your Web site
10/14/2008
Winrunner FAQ J Jagan Mohan
10/14/2008
Winrunner FAQ J Jagan Mohan
10/14/2008
Winrunner FAQ J Jagan Mohan
call cso_init();
call( 'C:\\MyAppFolder\\' & 'app_init' );
d) Compiled modules are loaded into memory to be referenced from TSL code in
any module. Example of a load statement:
10/14/2008
Winrunner FAQ J Jagan Mohan
while ( expression )
statement ;
i. While expression is true, the statement is executed. The loop ends when the
expression is false. For example, the while statement below performs the same
function as the for loop above.
set_window ('Open');
i=0;
while (i<5){
i++;
list_select_item ('File Name:_1', 'UI_TEST'); # Item Number 2
}
c) A do/while loop executes a block of statements for as long as a specified
condition is true. Unlike the for loop and while loop, a do/while loop tests the
conditions at the end of the loop, not at the beginning.
10/14/2008
Winrunner FAQ J Jagan Mohan
i=0;
do
{
menu_select_item ('File;Open Order...');
set_window ('Open Order');
button_press ('Cancel');
i++;
}
while (i<5);
10/14/2008
Winrunner FAQ J Jagan Mohan
The switch statement consecutively evaluates each case expression until one is
found that equals the initial expression. If no case is equal to the expression,
then the default statements are executed. The default statements are optional.
b) The switch statement consecutively evaluates each case expression until one
is found that equals the initial expression. If no case is equal to the expression,
then the default statements are executed. The default statements are optional.
10/14/2008
Winrunner FAQ J Jagan Mohan
105) Which TSL function you will use to compare two files?
a) We can compare 2 files in WinRunner using the file_compare function.
Syntax: file_compare (file1, file2 [, save file]);
107) What is the use of putting call and call_close statements in the test
script?
a) You can use two types of call statements to invoke one test from another:
i. A call statement invokes a test from within another test.
ii. A call_close statement invokes a test from within a script and closes the test
when the test is completed.
10/14/2008
Winrunner FAQ J Jagan Mohan
v. The test_name is the name of the test to invoke. The parameters are the
parameters defined for the called test.
vi. The parameters are optional. However, when one test calls another, the call
statement should designate a value for each parameter defined for the called
test. If no parameters are defined for the called test, the call statement must
contain an empty set of parentheses.
108) What is the use of treturn and texit statements in the test script?
a) The treturn and texit statements are used to stop execution of called tests.
i. The treturn statement stops the current test and returns control to the calling
test.
ii. The texit statement stops test execution entirely, unless tests are being called
from a batch test. In this case, control is returned to the main batch test.
b) Both functions provide a return value for the called test. If treturn or texit is not
used, or if no value is specified, then the return value of the call statement is 0.
treturn
c) The treturn statement terminates execution of the called test and returns
control to the calling test.
The syntax is:
treturn [( expression )];
d) The optional expression is the value returned to the call statement used to
invoke the test.
texit
e) When tests are run interactively, the texit statement discontinues test
execution. However, when tests are called from a batch test, texit ends execution
of the current test only; control is then returned to the calling batch test.
The syntax is:
texit [( expression )];
10/14/2008
Winrunner FAQ J Jagan Mohan
109) Where do you set up the search path for a called test.
a) The search path determines the directories that WinRunner will search for a
called test.
b) To set the search path, choose Settings > General Options. The General
Options dialog box opens. Click the Folders tab and choose a search path in the
Search Path for Called Tests box. WinRunner searches the directories in the
order in which they are listed in the box. Note that the search paths you define
remain active in future testing sessions.
110) How you create user-defined functions and explain the syntax?
a) A user-defined function has the following structure:
c) Parameters need not be explicitly declared. They can be of mode in, out, or
inout. For all non-array parameters, the default mode is in. For array parameters,
the default is inout. The significance of each of these parameter types is as
follows:
10/14/2008
Winrunner FAQ J Jagan Mohan
114) What does auto, static, public and extern variables means?
a) auto: An auto variable can be declared only within a function and is local to
that function. It exists only for as long as the function is running. A new copy of
the variable is created each time the function is called.
b) static: A static variable is local to the function, test, or compiled module in
which it is declared. The variable retains its value until the test is terminated by
10/14/2008
Winrunner FAQ J Jagan Mohan
an Abort command. This variable is initialized each time the definition of the
function is executed.
c) public: A public variable can be declared only within a test or module, and is
available for all functions, tests, and compiled modules.
d) extern: An extern declaration indicates a reference to a public variable
declared outside of the current test or module.
10/14/2008
Winrunner FAQ J Jagan Mohan
Two additional, optional parameters indicate the type of module. The first
parameter indicates whether the function module is a system module or a user
module: 1 indicates a system module; 0 indicates a user module.
(Default = 0)
The second optional parameter indicates whether a user module will remain
open in the WinRunner window or will close automatically after it is loaded: 1
indicates that the module will close automatically; 0 indicates that the module will
remain open.
(Default = 0)
c) The unload function removes a loaded module or selected functions from
memory.
d) It has the following syntax:
unload ( [ module_name | test_name [ , 'function_name' ] ] );
10/14/2008
Winrunner FAQ J Jagan Mohan
Two additional optional parameters indicate the type of module. The first
parameter indicates whether the module is a system module or a user module: 1
indicates a system module; 0 indicates a user module.
(Default = 0)
The second optional parameter indicates whether a user module will remain
open in the WinRunner window or will close automatically after it is loaded. 1
indicates that the module will close automatically. 0 indicates that the module will
remain open.
(Default = 0)
119) Why does the minus sign not appear when using obj_type(),
win_type(), type()?
If using any of the type() functions, minus signs actually means hold down the
button for the previous character. The solution is to put a backslash character '\\'
before the minus sign. This also applies to + < >.
10/14/2008
Winrunner FAQ J Jagan Mohan
127) What is the purpose of step, step into, step out, step to cursor commands
for debugging your script?
128) How do you update your expected results?
129) How do you run your script with multiple sets of expected results?
130) How do you view and evaluate test results for various check points?
131) How do you view the results of file comparison?
132) What is the purpose of Wdiff utility?
133) What are batch tests and how do you create and run batch tests ?
134) How do you store and view batch test results?
135) How do you execute your tests from windows run command?
136) Explain different command line options?
137) What TSL function you will use to pause your script?
138) What is the purpose of setting a break point?
139) What is a watch list?
140) During debugging how do you monitor the value of the variables?
10/14/2008