WinRunner Interview Preparation Guide
Download PDF

WinRunner Interview Questions and Answers will guide us that HP/Mercury Interactive WinRunner is an automated functional GUI testing tool that allows a user to record and play back UI interactions as test scripts. As a Functional test suite, it works together with HP QuickTest Professional and supports enterprise quality assurance. It captures, verifies and replays user interactions automatically, so you can identify defects and determine whether business processes work as designed.

67 WinRunner Questions and Answers:

1 :: How do you handle TSL exceptions?

Suppose you are running a batch test on an unstable version of your application. If your application crashes, you want WinRunner to recover test execution. A TSL exception can instruct WinRunner to recover test execution by exiting the current test, restarting the application, and continuing with the next test in the batch.
The handler function is responsible for recovering test execution. When WinRunner detects a specific error code, it calls the handler function. You implement this function to respond to the unexpected error in the way that meets your specific testing needs.

2 :: How do you handle pop-up exceptions?

A pop-up exception Handler handles the pop-up messages that come up during the execution of the script in the AUT. TO handle this type of exception we make WinRunner learn the window and also specify a handler to the exception. It could be
Default actions: WinRunner clicks the OK or Cancel button in the pop-up window, or presses Enter on the keyboard. To select a default handler, click the appropriate button in the dialog box.
User-defined handler: If you prefer, specify the name of your own handler. Click User Defined Function Name and type in a name in the User Defined Function Name box.

3 :: How do you handle unexpected events and errors?

WinRunner uses exception handling to detect an unexpected event when it occurs and act to recover the test run.
WinRunner enables you to handle the following types of exceptions:
Pop-up exceptions: Instruct WinRunner to detect and handle the appearance of a specific window.
TSL exceptions: Instruct WinRunner to detect and handle TSL functions that return a specific error code.
Object exceptions: Instruct WinRunner to detect and handle a change in a property for a specific GUI object.
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 during a test run.

4 :: What are the three modes of running the scripts?

WinRunner provides three modes in which to run tests: Verify, Debug, and Update. You use each mode during a different phase of the testing process.
Use the Verify mode to check your application.
Use the Debug mode to help you identify bugs in a test script.
Use the Update mode to update the expected results of a test or to create a new expected results folder.

5 :: WITHOUT the GUI map, use the phy desc directly?

It's easy, just take the description straight
out of the GUI map squigglies and all, put it
into a variable (or pass it as a string)
and use that in place of the object name.

button_press ( "btn_OK" );
button_press ("{class: push_button, label: OK}");

6 :: How to get the resolution settings?

Use get_screen_res(x,y) to get the screen resolution in WR7.5.
Use get_resolution (Vert_Pix_int, Horz_Pix_int, Frequency_int) in WR7.01

7 :: How to have winrunner insert yesterdays date into a field in the application?

1) Use get-time to get the PC system time in seconds since 01/01/1970
2)Subtract 86400 (no seconds in a day) from it
3)Use time_str to convert the result into a date format
4)If format of returned date is not correct use string manipulations to get the format you require
5) Insert the date into your application
Alternatively you could try the following :
1) In an Excel datasheet create a column with an appropriate name, and in the first cell of the column use the excel formula 'today() - 1'
2) Format the cell to give you the required date format
3) Use the ddt- functions to read the date from the excel datasheet
4) insert the reteived date into your application

8 :: How can withwin runner to make single scripts which supports multiple languages?

Actually, you can have scripts that run for different locales.I have a set of scripts that run for Japanese as well as English Locales. Idea is to have objects recorded in GUI Map with a locale independent physical description. This can be achieved in two ways.
1. After recording the object in the GUI Map, inspect the description and ensure that no language specific properties are used. For ex: html_name property for an object of class: html_text_link could be based on the text. You can either remove these language dependent properties if it doesnt really affect your object recognition. If it does affect, you need to find another property for the object that is locale independent. This new property may be something thats already there or you need to create them. This leads to the next option.
2. Have developers assign a locale independent property like 'objname' or something to all objects that you use in your automated scripts. Now, modify your GUI Map description for the particular object to look for this property instead of the standard locale dependent properties recorded by WR (these default properties are in GUI Map Configuration).

9 :: How to force WR to learn the sub-items on a menu?

If WR is not learning sub-items then the easy way id to add manually those sub items in to GUI map.. of course you need to study the menu description and always add the PARENT menu name for that particular sub-menu..

10 :: How to check property of specific Icon is highlighted or not?

set_window("Name of the window");
obj_check_info("Name of the object ","focused",0ut_value);

check for out_value & proceed further