Вы находитесь на странице: 1из 16

USING DATA BASE CONNECTIVITY IN WINRUNNER

1) compares current database data to expected database data.


db_check ( checklist, expected_results_file [ , max_rows [ , parameter_array ] ] );
In the following example, db_check creates a database checkpoint. "list_1.cdl" is the
name assigned to the database checklist captured for a test script; "dbvf1" indicates the
expected_results_file captured for this test.
db_check("list1.cdl", "dbvf1");
In the following example, db_check creates a database checkpoint. The parameters for
the SQL statement are in an array in the fourth parameter of the db_check statement.
param_array[1] = 3;
param_array[2] = 7;
db_check ("list1.cdl", "dbvf1", NO_LIMIT, param_array);

2) creates a new database session and establishes a connection to an ODBC database.


db_connect ( session_name, connection_string );
session_name The logical name of the database session.
connection_string The connection parameters to the ODBC database.
In the following example, WinRunner creates the "query1" database session and
establishes a connection to an ODBC database using the "DSN=Flight32" connection
string.
db_connect ("query1","DSN=Flight32");

3) disconnects from the database and ends the database session.


db_disconnect ( session_name );
In the following example, WinRunner disconnects from the "query1" database session.
db_disconnect ("query1");

4) executes the query based on the SQL statement and creates a record set.
db_execute_query ( session_name, SQL, record_number );
session_name The logical name of the database session.
SQL The SQL statement.
record_number An out parameter returning the number of records in the result query.
The db_execute_query function executes the query based on the SQL statement and
creates a record set.
In the following example, WinRunner executes the query based on the "SELECT *
FROM Orders" SQL statement and creates the record set, which has record_number
records.
db_execute_query ("query1","SELECT * FROM Orders",record_number);

5) returns the value of a single field in the database.

1
db_get_field_value ( session_name, row_index, column );
session_name The logical name of the database session.
row_index The index of the row written as a string: "# followed by the numeric index.
(The first row is always numbered "#0".)
column Either the name of the field in the column, or the index of the column
within the database written as a string: "# followed by the numeric index. (The first
column is always numbered "#0".)
The db_get_field_value function returns the value of a single field in the specified
row_index and column in the session_name database session.
In case of an error, an empty string will be returned.
In each of the following examples, WinRunner returns the value of a single field in the
"query1" database session.
val = db_get_field_value ("query1","#1","#1");
val = db_get_field_value ("query1","#1","Customer_Name");

6) returns the number of column headers in a query and the content of the column
headers, concatenated and delimited by tabs.
db_get_headers ( session_name, header_count, header_content );
In the following example, WinRunner returns the number of column headers in the
"query1" database session and all the strings in all column headers, concatenated and
delimited by tabs.
db_get_headers ("query1",field_num,headers);
split (headers, header_arr, "\t");

7) returns the content of the row, concatenated and delimited by tabs.


db_get_row ( session_name, row_index, row_content );
In the following example, WinRunner returns the content of the row, concatenated and
delimited by tabs.
db_get_row("query1",5,row_content);
split(row_content, line_arr, "\t");

8) compares information that appears in the application under test during a test run with
the current values in the corresponding record(s) in your database.
db_record_check ( ChecklistFileName , SuccessConditions, RecordNumber );
ChecklistFileName A file created by WinRunner and saved in the test's checklist
folder. The file contains information about the data to be captured during the test run and
its corresponding field in the database. The file is created based on the information
entered in the Runtime Record Checkpoint wizard.
SuccessConditions Contains one of the following values:

DVR_ONE_OR_MORE_MATCH - The checkpoint passes if one or more


matching database records are found.

DVR_ONE_MATCH - The checkpoint passes if exactly one matching database record is


found.
DVR_NO_MATCH - The checkpoint passes if no matching database records are
found.
RecordNumber An out parameter returning the number of records in the database.

2
The db_record_check function compares information that appears in the application
under test during a test run with the current values in the corresponding record(s) in your
database.
In the following example, db_record_check creates a runtime database record checkpoint.
"list_1.cvr" is the name assigned to the checklist captured for the test script;
"DVR_ONE_MATCH" indicates that the checkpoint will pass if one, and only one,
matching database record is found.
db_record_check("list1.cvr", DVR_ONE_MATCH, record_num);

USING DDT IN WR

1) creates or opens a data table file so that WinRunner can access it.
ddt_open ( data_table_name [ , mode ] );
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.
mode The mode for opening the data table: DDT_MODE_READ (read-only) or
DDT_MODE_READWRITE (read or write). When the mode is not specified, the default
mode is DDT_MODE_READ.
The ddt_open function opens the data table file with the specified data_table_name. The
active row becomes row number 1.

2) closes a data table file.


ddt_close ( data_table_name );
ddt_close(table);

3) ddt_close_all_tables();
The ddt_close_all_tables function closes all open tables in all open tests. Note that this
includes any tables that are open in the table editor, tables that were opened using the
ddt_open or ddt_show functions or/and using the DataDriven Tests Wizard.
In the following example, Test2 begins with the ddt_close_all_tests
function in order to close any open tables from any other open tests.
Test1:
# Open table1. ddt_open(table1);
# Open table2. ddt_open(table2);
# Open table3. ddt_open(table3);
Test2:
# Open table4. ddt_open(table4);
#Close all open tables (from both Test1 and Test2)
ddt_close_all_tests();

4) ddt_export ( data_table_namename1, data_table_namename2 );


data_table_namename1 The source data table filename.
data_table_namename2 The destination data table filename.
The ddt_export function sends the contents of data_table_name1 to data_table_name2.

3
In the following example, WinRunner exports the information from the Excel file entitled
"Default" to the Excel file entitled "flight".
ddt_export ( "C:\\mercury\\tmp\\merc1\\Default.xls" , "
C:\\mercury\\tmp\\merc1\\flight.xls" );

5) retrieves the active row of a data table.


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.
Note: When the data table is first opened, the active row is row 1.
The ddt_get_current_row function retrieves the active row in the specified data table and
returns this value as out_row.
In the following example, WinRunner checks to see if the Error message reported on the
Flight Reservation Message window is correct. If not; the report message displays that
the test passed but had an incorrect error message.
testname=getvar("testname");
table=testname & "\\default.xls" ;
if (static_check_text("Message", ddt_val(table, "Error Message")) == E_OK) {
rc=ddt_get_current_row(table,row);
if(rc= E_OK) {
tl_msg = sprintf(get_current_row_failed, table, rc);
tl_step (illegal_login, FAIL,tl_msg);
row =0;
}
}

6) returns a list of all parameters in a data table.


ddt_get_parameters ( table, params_list, params_num );
table The pathname of the data table.
params_list This out parameter returns the list of all parameters in the data table,
separated by tabs.
params_num This out parameter returns the number of parameters in params_list.
The ddt_get_parameters function returns a list of all parameters in a data table.
Note: You must use a ddt open statement to open the data table before you can use any
other ddt_ functions.
In the following example, the ddt_get_parameters function returns the list of parameters
and number of parameters in the table.xls data table.
# Assume that E:\\WinRunner\\tmp\\table.xls is a valid path holding a table with the 2
parameters
# name & age.
# In the ddt_get_parameters function, the variable params_list will hold the parameters
name & age
# and the variable params_num will hold the number of parameters, which is 2.
table = "E:\\WinRunner\\tmp\\table.xls";
# Open the table specified above.

4
rc = ddt_open(table);
if (rc!=E_OK)
pause("ERROR");
# Get the table parameters.
ddt_get_parameters(table,params_list,params_num);
ddt_close(table);

7) retrieves the number of rows in a data table.


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.
The ddt_get_row_count function retrieves the number of rows in the specified data table.
Note: You must use a ddt open statement to open the data table before you can use any
other ddt_ functions.
In the following example, the test creates a new data table named Default.xls. The
ddt_get_row_count function retrieves the number of rows in the data table. In this case,
the number of rows will be zero, because no data has been inserted into the table.
table = "Default.xls";
# Create a new table which is blank.
rc = ddt_open(table);
if (rc!=E_OK)
pause("ERROR");
# Get the number of rows in the table.
ddt_get_row_count(table,row_count);
# row_count will store the number of rows in the table.
# Since the table is empty, row_count will be equal to 0.
ddt_close(table);

8) changes the active row in a data table to the next row.


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.
Note: If the active row is the last row in a data table, then the E_OUT_OF_RANGE value
is returned.
The ddt_next_row function changes the active row in the specified data table to the next
row.
Note: You must use a ddt open statement to open the data table before you can use any
other ddt_ functions.
In the following example, the test opens a data table named table.xls. Each row in the
data table contains data. The ddt_report_row function reports the active row in the data
table to the test results. The ddt_next_row function changes the active row to the next
row.
# Assume that E:\\WinRunner\\tmp\\table.xls is a valid path, which holds data.
table = "E:\\WinRunner\\tmp\\table.xls";

5
# Open the table.
rc = ddt_open(table);
if (rc!=E_OK)
pause("ERROR");
do
{
# Reports the active row to the test results.
rc=ddt_report_row(table);
if (rc!=E_OK)
pause("ERROR");
}
# Go to the next row.
while (ddt_next_row(table)==E_OK);
ddt_close(table);

9) sets a value in the current row of the data table.


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.
The ddt_set_val function sets a value in a cell of the current row of a database. To save
the new or modified contents of the table, add a ddt save statement after the ddt_set_val
statement. At the end of your test, use a ddt close statement to close the table.

Note: You can only use this function if the data table was opened in
DDT_MODE_READWRITE (read or write mode).
In the following example, WinRunner inserts the name "Klein" into the "new" column in
the row which is currently in use.
ddt_set_val ( "C:\\mercury\\tmp\\merc1\\flight.xls","new","Klein" );

10) shows or hides the table editor of a specified data table.


ddt_show ( data_table_name [ , show_flag ] );
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).
The ddt_show function allows the table editor to be shown or hidden. The show_flag
value is 1 if the table editor is to be shown and is 0 if the table editor is to be hidden.
In the following example, WinRunner shows the table editor of the table entitled "flight".
ddt_show ("C:\\mercury\\tmp\\merc1\\flight.xls", 1 );
In the following example, WinRunner hides the table editor of the table entitled "flight".
ddt_show ("C:\\mercury\\tmp\\merc1\\flight.xls", 0 );

6
EXCEPTION HANDLING IN WR

1) defines an object exception.


define_object_exception ( exception_name, handler, window, object, property [,
value] );
exception_name The name of the exception.
handler The name of the handler function.
window The logical name of the window.
object The logical name of the object.
property An object property.
value The value of the object property to detect.
The define_object_exception function defines an object exception. The value parameter is
optional. If you do not specify the value, the exception is defined to detect any change
from the current property value. In this case, the object must appear when you define the
exception.
Note that the property you specify for the exception cannot appear in the object's physical
description in the GUI map.
To enable exception handling from a test script, you must use the exception_on function

2) defines a popup exception.


define_popup_exception ( exception_name, handler, window );
exception_name The name of the exception.
handler The name of the handler function. The handler can be a built-in handler or
a user-defined handler. For a list of built-in handlers, see below.
window The name of the popup window.
The define_popup_exception function defines a popup exception. The window parameter
can be the title or the logical name of the popup window. If the logical name is specified,
the label attribute must be part of the window's physical description—if it is not, the
exception cannot be defined.
If the window for the pop-up exception is not in the GUI map when the exception is set,
it is assumed that the given name is the title of the window.
To use one of the built-in TSL functions for the handler parameter:
· Specify win_press_cancel to click the Cancel button in the window.
· Specify win_press_ok to click the OK button in the window.
· Specify win_press_return to press the Return key (the equivalent of clicking the
default button in the window).
To enable handling of the exception from a test script, you must use exception_on.
3) defines a TSL exception.
define_tsl_exception ( exception_name, handler, return_code [, function ] );
exception_name The name of the exception.
handler The name of the handler function.
return_code The return code to detect. To detect any return code with a value less than
zero, you can set E_ANY_ERROR as the argument.
function The TSL function to monitor.
The define_tsl_exception function defines a TSL exception. The function parameter is
optional. If you do not specify a TSL function, the exception is defined for any TSL
function in which the specified return code is returned.

7
To enable handling of the exception from a test script, you must use the exception_on
function.

4) enables exception handling.


exception_on ( exception );
exception A string expression that names the exception. The string cannot contain
any spaces.
The following example shows a handler function of the exception "label_except", which
was previously defined either using the define_TSL_exception function or the Exceptions
dialog box. This handler function turns off the handling of this exception before
executing the recovery script of reopening the AUT. Then it turns the exception handling
on again.
public function label_handler(in win, in obj, in attr, in val)
{
#ignore this exception while it is handled:
exception_off("label_except");
report_msg("Label has changed");
menu_select_item ("File;Exit");
system ("flights&");
invoke_application ("flights", "", "C:\\FRS", "SW_SHOWMAXIMIZED");
#if the value of "attr" no longer equals "val":
exception_on("label_except");
texit;

5) disables exception handling.


exception_off ( exception_name );
exception_name The name of the exception.
The exception_off function disables the detection of the specified exception. To enable
exception handling, use the exception_on function.
The following example shows a handler function of the exception "label_except", which
was previously defined either using the define_TSL_exception function or the Exceptions
dialog box. This handler function turns off the handling of this exception before
executing the recovery script of reopening the AUT. Then it turns the exception handling
on again.

public function label_handler(in win, in obj, in attr, in val)


{
#ignore this exception while it is handled:
exception_off("label_except");
report_msg("Label has changed");
menu_select_item ("File;Exit");
system ("flights&");
invoke_application ("flights", "", "C:\\FRS", "SW_SHOWMAXIMIZED");
#if the value of "attr" no longer equals "val":
exception_on("label_except");
texit;
}

8
6) disables handling of all exceptions.
exception_off_all ( );
The exception_off_all function disables all previously activated exceptions.
The following example shows a handler function of some exception. This handler
function turns off all exception handling before closing the AUT.
public function capture_handler (in rc, in func)
{
# turn of all exceptions
exception_off_all() ;
# Write a message to the report and close the application.
report_msg("Capture failed. Closing the application.");
menu_select_item("File;Exit");
texit;
}

DOS COMMANDS IN WR

1) executes a DOS system command.


dos_system ( expression );
expression A string expression specifying the system command to be executed.
The dos_system function executes a DOS system command from within a WinRunner
test script. Test execution pauses while the operating system command is executed. The
DOS system command can be executed without being followed by a wait statement. Note
that the command must be one that completes execution without requiring further
keyboard input.
Note: When using MS-DOS Prompt (Windows 95/98), or command.com (Windows
NT), then the expression in dos_system is limited to 127 characters. When using
Command Prompt (Windows NT), the expression can hold more characters.
If the limitation is problematic, try to use shorter commands and split long commands
into shorter ones. For example, if you want to copy file1 to file2
and both files have very long names, instead of using dos_system("copy file1 file2") use
a third file with a shorter name (e.g. tmpfile) in the following commands:
dos_system("copy file1 tmpfile") ;
dos_system("copy tmpfile file2") ;

USING FILES IN WR

1) opens a file or creates a new file.


file_open ( file_name, mode );
file_name The name of the file to open or create.
mode The file mode:
FO_MODE_READ, or 0 (read only);
FO_MODE_WRITE, or 1 (write only);
FO_MODE_APPEND, or 2 (write only, to the end of the file).

9
Note that if the file does not exist in the specified path, then if the file mode is
FO_MODE_WRITES, WinRunner creates the file. If the specified path does not exist,
the file is not created and the command fails.
In the following example, the contents of readme.txt are printed to readme2.txt. The
file_open function opens readme.txt in read only mode and readme2.txt in write only
mode.
file_open("C:\\readme.txt",FO_MODE_READ);
file_open("C:\\readme2.txt",FO_MODE_WRITE);
i=0;
while(file_getline("C:\\readme.txt",line)==0)
{
i++;
file_printf("C:\\readme2.txt","%d "&toupper(line),i);
}
file_close("C:\\readme.txt");
file_close("C:\\readme2.txt");

2) closes a file that was opened with file_open.


file_close ( file_name );
file_name The name of the file to close.
The file_close function closes a file that was opened using file_open.
In the following example, the contents of readme.txt are printed to readme2.txt. The
file_close function closes both files at the end of the test.
file_open("C:\\readme.txt",FO_MODE_READ);
file_open("C:\\readme2.txt",FO_MODE_WRITE);
i=0;
while(file_getline("C:\\readme.txt",line)==0)
{
i++;
file_printf("C:\\readme2.txt","%d "&toupper(line),i);
}
file_close("C:\\readme.txt");
file_close("C:\\readme2.txt");

3) compares the contents of two files.


file_compare ( file1, file2 [ , save_file ] );
file1 The name of a file to compare to file2. If the file is not in the current test
directory, then include the full path.
file2 If the file is not in the current test directory, then include the full path.
save_file The name of a file that saves the files for future viewing.
In the following example, WinRunner tests the Save As capabilities of the Notepad
application. The test opens the win.ini file in Notepad and saves it under the name
win1.ini. The file_compare function is then used to check whether the new file is
identical to the original one and to store the differences file in the test directory.
# Open win.ini using Notepad.

10
system("notepad.exe win.ini");
set_window("Notepad",1);
# Save win.ini as win1.ini
menu_select_item("File;Save As...");
set_window("Save As");
edit_set("File Name:_0","c:\win31\win1.ini");
set_window("Save As", 1);
button_press("OK");
# Compare win.ini to win1.ini and save both files to "save".
file_compare("c:\\win31\\win.ini","c:\\win31\\win1.ini","save");

4) prints formatted output to an open file.


file_printf ( file_name, format, exp1 [ , exp2,... exp30 ] );
In the following example, the file_printf function prints, line by line, the contents of the
file readme2.txt.
file_open("C:\\readme.txt",FO_MODE_READ);
file_open("C:\\readme2.txt",FO_MODE_WRITE);
i=0;
while(file_getline("C:\\readme.txt",line)==0)
{
i++;
file_printf("C:\\readme2.txt","%s "&toupper(line),i);
}
file_close("C:\\readme.txt");
file_close("C:\\readme2.txt");

5) reads the next line from a file and assigns it to a variable.


file_getline ( file_name, out_line );
In the following example, the contents of readme.txt are printed to readme2.txt. The
file_getline function reads each line of readme.txt and stores it in "line."
file_open("C:\\readme.txt",FO_MODE_READ);
file_open("C:\\readme2.txt",FO_MODE_WRITE);
i=0;
while(file_getline("C:\\readme.txt",line)==0)
{
i++;
file_printf("C:\\readme2.txt","%d "&toupper(line),i);
}
file_close("C:\\readme.txt");
file_close("C:\\readme2.txt");

6) returns the number of arguments passed.


nargs ( );
The nargs function returns the number of arguments passed to a function or test. It
contains no arguments. It may appear in a user-defined function or in the context of a test.

USING PASSWORD IN WR

11
1) encrypts a plain password.
password_encrypt ( password );
password The plain password.
You use the password_encrypt function when you import a password from an external
database after having used the password edit set function and you want to encrypt that
particular password. Alternatively, you can use the edit_set function to set the edit field's
value with the plain password string.
In the following example, the user imports a password from a data table and encrypts the
password using the password_encrypt function.
plain_pw = ddt_val ( table, "password");
encrypted_pw = password_encrypt (plain_pw);

2) pauses test execution and displays a message box.


pause ( [ expression ] );
expression Any valid expression.
The pause function pauses a test run at the current line in the script, and displays a
message box. The message box displays the enclosed expression, evaluated to a string.
The default message is "Pause."
The message box contains two buttons, "Pause" and "Continue." Select Pause to close the
message box and pause the test. To resume test execution, select a run command. Select
Continue to restart test execution from the point where you invoked Pause.
Example
In the following example, pause pauses test execution and displays the time that elapsed
between two points.
t1 = get_time();
wait(1);
t2 = get_time();
pause ("Time elapsed is " & t2 - t1);

INVOKE_APPLICATION IN WR

1) invokes a Windows application from within a test script.


invoke_application ( file, command_option, working_dir, show );
file The full path of the application to invoke.
command_option The command line options to apply.
working_dir The working directory for the specified application.
show Specifies how the application appears when opened. This parameter can be one of
the following constants:
Value Description
SW_HIDE Hides the window and passes activation to another window.
SW_MINIMIZE Minimizes the window and activates the top-level window in the
system list.
SW_RESTORE Activates and displays the window. If the window is minimized or
maximized, WinRunner restores it to its original size and position (same as
sw_shownormal).
SW_SHOW Activates the window and displays it in its current size and position.
SW_SHOWMAXIMIZED Activates the window and displays it as a maximized
window.

12
SW_SHOWMINIMIZED Activates the window and displays it as an icon.
SW_SHOWMINNOACTIVE Displays the window as an icon. The window that is
currently active remains active.
SW_SHOWNA Displays the window in its current state. The currently active
window remains active.
SW_SHOWNOACTIVATE Displays the window in its most recent size and position.
The currently active window remains active.
SW_SHOWNORMAL Activates and displays the window. If the window is
minimized or maximized, WinRunner restores it to its original size and position (same as
SW_SHOWRESTORE).
The invoke_application command runs a Windows executable (*.exe file). Test execution
is paused while the operating system command is executed.
Use dos_system to execute DOS system commands.
In the following example, the test invokes the Notepad text editor. If the test is unable to
invoke the application, a message is sent to the report.
if (invoke_application("notepad","","C:\\TEXT",SW_SHOWMINIMIZED)!=0)
{
report_msg("AUT is not found. exiting.");
texit;
}
else call batch_test();

CUSTOMIZATION FUNCTIONS IN WR
Customization functions allow you to enhance your testing tool so that it better supports
your specific needs. For example, you can add functions to the Function Generator, or
create custom GUI checkpoints.

1) filename = create_browse_file_dialog( "*.dll;*.exe" );


2) res = create_custom_dialog ("run_application1", "Initial Conditions", "Run",
"Application:, Geometry:, Background:, Foreground:, Font:", "Sound, Speed");
3) a=create_input_dialog ("Please type in your name.");
4) c=create_list_dialog ("List Box", "Select an Input File", "Batch_1, clock_2,
Main_test, Burger_4");
5) creates a password dialog box.
6) create_password_dialog ( login, password, login_out, password_out [
,encrypt_password] );

login The label of the first edit box, used for user-name input. If you specify an empty
string (empty quotation marks), the default label "Login" is displayed.
password The label of the second edit box, used for password input. If you specify
an empty string (empty quotation marks), the default label "Password" is displayed.
When the user enters input into this edit box, the characters do not appear on the screen,
but are represented by asterisks.
login_out The name of the parameter to which the contents of the first edit box
(login) are passed. Use this parameter to verify the contents of the login edit box.
password_out The name of the parameter to which the contents of the second edit box
(password) are passed. Use this parameter to verify the contents of the password edit box.

13
encrypt_password A Boolean parameter which allows the output edit field value to be
encrypted. If this parameter is left blank, the default value is FALSE.
The create_password_dialog creates a dialog box with two edit boxes, one for login name
input, and one for password input. You use a password dialog box to limit user access to
tests or parts of tests. A password dialog box has two edit boxes, an OK button, and a
Cancel button. You supply the labels for the edit boxes. The text that the user types into
the edit boxes during interactive test execution is returned for analysis. For details on
creating a user interface to pass input to your test during interactive test execution, refer
to the "Creating Dialog Boxes for Interactive Input" chapter in your WinRunner User's
Guide.
Note: You cannot use this function in a test you run in batch mode or in silent mode,
because no one is monitoring the computer where the test is running to view the
messages.

In the following example, a password dialog box is created using the default edit box
labels. If you click the OK button, the value 1 is passed to the status variable and the
entered text is passed to the user_name and password variables. If you click the Cancel
button, the value 0 is passed to the status variable and the login_out and password_out
parameters are assigned empty strings.

status = create_password_dialog ("","", user_name, password);


silent_mode (getvar)
Displays whether WinRunner is running in silent mode. In silent mode, WinRunner
suppresses messages during a test run so that a test can run unattended. When you
run a test remotely from TestDirector, you must run it in silent mode, because no
one is monitoring the computer where the test is running to view the messages.
(Default = off)

Mercury WinRunner Features and Benefits

Increase power and flexibility of tests without any programming: The Function
Generator presents a quick and error-free way to design tests and enhance scripts without
any programming knowledge. Testers can simply point at a GUI object, and Mercury
WinRunner® will examine it, determine its class and suggest an appropriate function to
be used.

Use multiple verification types to ensure sound functionality: Mercury


WinRunner provides checkpoints for text, GUI, bitmaps, URL links and the database,
allowing testers to compare expected and actual outcomes and identify potential
problems with numerous GUI objects and their functionality.

Verify data integrity in your back-end database: Built-in Database Verification


confirms values stored in the database and ensures transaction accuracy, as well as the
data integrity of records that have been updated, deleted, and added.

14
View, store, and verify at a glance every attribute of tested objects: Mercury
WinRunner's GUI Spy automatically identifies, records and displays the properties of
standard GUI objects, ActiveX controls, as well as Java objects and methods. This
ensures that every object in the user interface is recognized by the script and can be
tested.

Maintain tests and build reusable scripts: The GUI map provides a centralized
object repository, allowing testers to verify and modify any tested object. These changes
are then automatically propagated to all appropriate scripts, eliminating the need to build
new scripts each time the application is modified.

Test multiple environments with a single application: Mercury WinRunner


supports more than 30 environments, including Web, Java, Visual Basic, etc. In addition,
it provides targeted solutions for such leading ERP/CRM applications as SAP, Siebel,
PeopleSoft, and a number of others.

Simplify creation of test scripts: Mercury WinRunner's DataDriver Wizard greatly


simplifies the process of preparing test data and scripts. This allows for optimal use of
QA resources and results in more thorough testing.

Automatically identify discrepancies in data: Mercury WinRunner examines and


compares expected and actual results using multiple verifications for text, GUI, bitmaps,
URLs, and databases. This ensures stable functionality and execution of business
transactions when the application is released into production.

Validate applications across browsers: Mercury WinRunner enables you to use the
same test to validate applications in Internet Explorer, Netscape, and AOL. This saves
testing time and reduces the number of scripts that must be developed and maintained.

Automatically recover tested applications from a crash: Unexpected events,


errors, and application crashes during a test run can disrupt the testing process and distort
results. Mercury WinRunner's Recovery Manager enables unattended recovery and
provides a wizard that guides the process of defining a recovery scenario.

Leverage investments in other testing products: Mercury WinRunner fully


integrates with our other testing solutions, including Mercury LoadRunner® for load
testing and Mercury TestDirector™ for global test management. Moreover, organizations
can reuse Mercury WinRunner test scripts with Mercury QuickTest Professional™.

Full integration with Mercury Business Process Testing: With Mercury


WinRunner 8.2's compatiblity with Mercury Business Process Testing™ , you have the
ability to create business process components as well as convert existing Mercury
WinRunner scripts to components. With Mercury Business Process Testing, subject
matter experts and automation engineers collaborate to increase effectiveness.

15
Mercury TestDirector Features and Benefits

Supports the entire testing process — requirements management; planning,


building, scheduling, and executing tests; defect management; and project status analysis
— through a single Web-based application

Allows teams to access testing assets anytime, anywhere via a browser interface

Integrates with the industry’s widest range of third-party applications, preserves


your investment in existing solutions, and creates an end-to-end quality-management
infrastructure

Manages manual and automated tests. Helps jumpstart automation projects

Accelerates testing cycles by scheduling and running tests automatically,


unattended, 24x7. Results are stored in a central repository, creating an accurate audit
trail for analysis and enabling consistent quality processes.

Allows teams to analyze application readiness at any point in the testing process
with integrated graphs and reports

16

Вам также может понравиться