Winrunner Page 7
 
Testing Technologies
Load Runner
Win Runner
QTP
SilkTest

Manual Testing

Automated Testing

Test Director

Courses for International Certifications, ASQ CQE, CSTE, CSQA, ISEB, ISTQB

 

 

99)Write and explain decision making command?

a.You can incorporate decision-making into your test scripts using if/else or switch statements.

i.An if/else statement executes a statement if a condition is true; otherwise, it executes another statement.

It has the following syntax:

if ( expression )

statement1;

[ else

statement2; ]

expression is evaluated. If expression is true, statement1 is executed. If expression1 is false, statement2 is executed.

b.A switch statement enables WinRunner to make a decision based on an expression that can have more than two values.

It has the following syntax:

switch (expression )

{

case case_1: statements

case case_2: statements

case case_n: statements

default: statement(s)

}

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.

100)Write and explain switch command?

a.A switch statement enables WinRunner to make a decision based on an expression that can have more than two values.

It has the following syntax:

switch (expression )

{

case case_1:statements

case case_2: statements

case case_n: statements

default: statement(s)

}

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.

101)How do you write messages to the report?

A.To write message to a report we use the report_msg statement

Syntax: report_msg (message);

102)What is a command to invoke application?

A.Invoke_application is the function used to invoke an application.

Syntax: invoke_application(file, command_option, working_dir, SHOW);

103)What is the purpose of tl_step command?

Used to determine whether sections of a test pass or fail.

Syntax:tl_step(step_name, status, description);

1)104)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]);

2)105)What is the use of function generator?

A.A.The Function Generator provides a quick, error-free way to program scripts. You can:

i.Add Context Sensitive functions that perform operations on a GUI object or get information from the application being tested.

ii.Add Standard and Analog functions that perform non-Context Sensitive tasks such as synchronizing test execution or sending user-defined messages to a report.

i.Add Customization functions that enable you to modify WinRunner to suit your testing environment.

106)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.

iii.The call statement has the following syntax:

1.call test_name ( [ parameter1, parameter2, ...parametern ] );

iv.The call_close statement has the following syntax:

1.call_close test_name ( [ parameter1, parameter2, ... parametern ] );

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.

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

108)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.

109)How you create user-defined functions and explain the syntax?

a.A user-defined function has the following structure:

[class] function name ([mode] parameter...)

{

declarations;

statements;

}

b.The class of a function can be either static or public. A static function is available only to the test or module within which the function was defined.

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:

in: A parameter that is assigned a value from outside the function.

out: A parameter that is assigned a value from inside the function.

inout: A parameter that can be assigned a value from outside or inside

the function.

110)What does static and public class of a function means?

a.The class of a function can be either static or public .

b.A static function is availableonly to the test or module within which the function was defined .

c.Once you execute a public function , it is available to all tests, for as long as the test containing the function remains open . This is convenient when you want the function to be accessible from called tests. However, if you want to create a function that will be available to many tests, you should place it in a compiled module. The functions in a compiled module are available for the duration of the testing session.

d.If no class is explicitly declared, the function is assigned the default class, public.

111)What does in, out and input parameters means?

a.in: A parameter that is assigned a value from outside the function.

b.out: A parameter that is assigned a value from inside the function.

c.inout: A parameter that can be assigned a value from outside or inside the function.

112)What is the purpose of return statement?

A.This statement passes control back to the calling function or test. It also returns the value of the evaluated expression to the calling function or test. If no expression is assigned to the return statement, an empty string is returned.

Syntax: return [( expression )];

113)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 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.

114)How do you declare constants?

a.The const specifier indicates that the declared value cannot be modified. The class of a constant may be either public or static. If no class is explicitly declared, the constant is assigned the default class public. Once a constant is defined, it remains in existence until you exit WinRunner.

d.b.The syntax of this declaration is:

[class] const name [= expression];

115)How do you declare arrays?

a.The following syntax is used to define the class and the initial expression of an array. Array size need not be defined in TSL.

e.b.class array_name [ ] [=init_expression]

c.The array class may be any of the classes used for variable declarations (auto, static, public, extern).

116)How do you load and unload a compile module?

a.In order to access the functions in a compiled module you need to load the module. You can load it from within any test script using the load command; all tests will then be able to access the function until you quit WinRunner or unload the compiled module.

b.You can load a module either as a system module or as a user module. A system module is generally a closed module that is “invisible” to the tester. It is not displayed when it is loaded, cannot be stepped into, and is not stopped by a pause command. A system module is not unloaded when you execute an unload statement with no parameters (global unload).

load (module_name [,1|0] [,1|0] );

The module_name is the name of an existing compiled module.

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)

f.c.The unload function removes a loaded module or selected functions from memory.

g.d.It has the following syntax:

unload ( [ module_name | test_name [ , "function_name" ] ] );

117)Why you use reload function?

a.If you make changes in a module, you should reload it. The reload function removes a loaded module from memory and reloads it (combining the functions of unload and load).

The syntax of the reload function is:

reload ( module_name [ ,1|0 ] [ ,1|0 ] );

The module_name is the name of an existing compiled module.

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)

118)Write TSL functions for the following interactive modes:

i.Creating a dialog box with any message you specify, and an edit field.

ii.Create dialog box with list of items and message.

iii.Create dialog box with edit field, check box, and execute button, and a cancel button.

iv.Creating a browse dialog box from which user selects a file.

v.Create a dialog box with two edit fields, one for login and another for password input.

119)What is the purpose of step, step into, step out, step to cursor commands for debugging your script?

Step:Stepbutton to execute only the current line of the active test script— the line marked by the execution arrow.

Step Into: The Step Into command calls and displays another test or user- defined function.

Step Out:The Step Out command— used in conjunction with Step Into— completes he execution of a called test or user- defined function.

Step to Cursor: Step Out executes to the end of the called test or user-definedfunction,returns to the calling test, and then pauses execution.

120)What is the purpose of Wdiff utility?

In

You can view the results of text content checks or structure checks of cells or

frames using the WDiff utility. The WDiff utility displays the expected and actualresults. Differences are highlighted. This utility is accessed from the GUICheckpoint Results dialog box.

121)How do you execute your tests from windows run command?

To start WinRunner from the Run command:

1On the Windows Start menu, choose Run . The Run dialog box opens.

2Type in the path of your WinRunner wrun. exe file, and then type in any

command line options you want to use.

3Click OK to close the dialog box and start WinRunner.

122)Explain different command line options?

Following is a description of each command line option.

-addins list of add- ins to load

instructs WinRunner to load the specified add- ins. In the list, the add- ins are separated by commas. (Formerly -addons. )

-addins_ select_ timeout timeout

instructs WinRunner to wait the specified time (in seconds) before closing the

Add- In Manager dialog box when starting WinRunner. When the timeout

iszero,the dialog box is not displayed.This can be used in conjunction with

the -addins command line option.(Formerly -addons_ select_ timeout. )

-animate

Instructs WinRunner to execute and run the loaded test, while the execution arrow displays the line of the test being run.

-auto_ load {on | off}

Activates or deactivates automatic loading of the temporary GUI map file.

(Default = on )

-auto_ load_ dir path

Determines the folder in which the temporary GUI map file (temp. gui) resides.This option is applicable only when auto load is on.(Default = M_ Home\ dat )

-batch {on | off}

Runs the loaded test in Batch mode.(Default = off )

-beep {on | off}

Activates or deactivates the WinRunner system beep.(Default = on )

-create_ text_ report {on | off}

Instructs WinRunner to write test results to a text report, report. txt, which is saved in the results folder.(Default = off )

-cs_ fail {on | off}

Determines whether WinRunner fails a test when Context Sensitive errors occur.(Default = off )

-cs_ run_ delay non- negative integer

Sets the time (in milliseconds) that WinRunner waits between executing Context Sensitive statements when running a test.(Default = 0 [milliseconds])

-delay_ msec non- negative integer

Directs WinRunner to determine whether a window or object is stable before capturing it for a bitmap checkpoint or synchronization point. (Formerly -delay .)(Formerly - delay , which was measured in seconds.)(Default = 1000 [milliseconds])

-dont_ connect

If the “Reconnect on startup” option is selected in the Connection to Test Director dialog box, this command line enables you to open WinRunner without connecting to Test Director.

-dont_ quit

Instructs WinRunner not to close after completing the test.

-dont_ show_ welcome

Instructs WinRunner not to display the Welcome window when starting WinRunner.

-exp expected results folder name

Designates a name for the subfolder in which expected results are stored. In a verification run, specifies the set of expected results used as the basis for the verification comparison.(Default = exp )

-fast_ replay {on | off}

Sets the speed of the test run. on sets tests to run as fast as possible and off sets tests to run at the speed at which they were recorded.(Default = on )

-f file name

Specifies a text file containing command line options. The options can appear on the same line, or each on a separate line.

-fontgrp group name

Specifies the active font group when WinRunner is started.

-ini initialization test name

Defines the wrun. ini file that is used when WinRunner is started. This file is read-only, unless the -update_ ini command line option is also used.

-min_ diff non- negative integer

Defines the number of pixels that constitute the threshold for an image mismatch.(Default = 0 [pixels])

-mismatch_ break {on | off}

Activates or deactivates Break when Verification Fails before a verification run.The functionality of Break when Verification Fails is different than when running a test interactively. (Default = off )

-rec_ item_ name {0 | 1}

Determines whether WinRunner records non- unique ListBox and ComboBox items by name or by index.(Default = 0 )

-run

Instructs WinRunner to run the loaded test. To load a test into the WinRunner window, use the -t command line option.

-run_ minimized

Instructs WinRunner to open minimized. Note that specifying this option does Not itself run tests: use the -t command line option to load a test and the -run

command line option to run the loaded test.

-search_ path path

Defines the directories to be searched for tests to be opened and/ or called. The search path is given as a string.(Default=startup folder and installation folder\ lib )

-single_ prop_ check_ fail {0 | 1}

Fails a test run when _check_ info statements fail. It also writes an event toThe Test Results window for these statements.You can use this option with the setvar and getvar functions.(Default = 1)

-speed {normal | fast}

Sets the speed for the execution of the loaded test.(Default = fast )

-t test name

Specifies the name of the test to be loaded in the WinRunner window. This can be the name of a test stored in a folder specified in the search path or the full pathname of any test stored in your system.

-td_ connection {on | off}

Activates or deactivates WinRunner’s connection to TestDirector.

(Default = off ),(Formerly -test_ director. )

-td_ cycle_ name cycle name

Specifies the name of the current test cycle. This option is applicable only when WinRunner is connected to TestDirector.(Formerly -cycle. )

-td_ database_ name database path

Specifies the active TestDirector database. WinRunner can open, execute, and save tests in this database.(Formerly - database. )

-td_ log_ dirname event log file path

Defines the full pathname for an event log file. Note that this file is not a

TestDirector file.(Formerly -td_ logname_ dir. )

-td_ password password

Specifies the password for connecting to a database in a TestDirector server.

-td_ server_ name server name

Specifies the name of the TestDirector server to which WinRunner connects. (Formerly -td_ server. )

-td_ user_ name user name

Specifies the name of the user who is currently executing a test cycle.

(Formerly -user_ name or user. )

-timeout_ msec non- negative integer

Sets the global timeout (in milliseconds) used by WinRunner when executing checkpoints and Context Sensitive statements. (Formerly timeout, which was measured in seconds.) (Default = 1000 [milliseconds]) (Formerly -timeout .)

-tslinit_ exp expected results folder

Directs WinRunner to the expected folder to be used when the tslinit script is running.

-update_ ini

Saves changes to configuration made during a WinRunner session when thewrun. ini file is specified by the -ini command line option.

-verify verification results folder name

Specifies that the test is to be run in Verify mode and designates the name of the subfolder in which the test results are stored

More Winrunner questions

Page 1

Page 2

Page 3 

Page 4

Page 5

Page 6   

Page 7