Wednesday, September 22, 2010

Introduction to WinRunner

While Recording WinRunner stores the Object description in the GUI Map.
WinRunner uses the objecct description in the GUI Map file, and produces the results.

WinRunner uses Mercury Interactive Test Script Language (TSL) for scripting.

How does winrunner identify the objects
Winrunner uses object's physical attributes to identify the object.

How does winrunner uniquely identifies the objects
Winrunner uses the minimum number of attributes to achieve unique identification.

Winrunner identifies the objects within the scope of the parent window.

GUI Map File

GUI Map file contains:
1. Windows of the AUT
2. Objects within each window
3. Physical attributes that create each object's unique identification

Run Modes

1. Debug Mode
2. Verify Mode
3. Update Mode

Recording Modes in WinRunner

1. Context Sensitive Mode
2. Analog Mode

Commands of WinRunner

Statements in Context Sensitive Mode
invoke_application("Notepad","","c:\\temp",SW_SHOW);
set_window("Login",10); Waits for the specified window to appear on screen. If the window appears before the timeout, the script immediately proceeds to the next line.
button_press("OK") ;
button_set("Order","ON")
win_activate
win_exists("Flight Reservations",2)
list_get_num_items
list_select_item("Make","BMW");
edit_set("User ID:","guest");
password_edit_set("password","mxpvnwoulxjxau");
edit_get_text
menu_select_item("File;Openn Order");
GUI_close_all();
GUI_close("");
GUI_load("X:\\guimaps_myguifile.gui");

Synchronization Statement
Object Synchronization Statements
win_wait_info("Payment","enabled",0,30);
obj_wait_info("StatusBar","label","Done",20)

Time Synchronization

wait(10) ; waits for the specified amount of time


Bitmap Synchronization

obj_wait_bitmap("Object","Img1",10)
win_wait_bitmap("Screen","Img2",10, 210, 175, 80, 22)

GUI Checkpoints
Verifies whether object's properties match with the expected results. Checkpoint differs depending on the object to be verified.
For Example:
Single Property check GUI checkpoints
List Box control - list_check_info
Button control (check box, radio button, push button) - button_check_info
Generic Object - Obj_check_info
Window - Win_check_info
Multiple Property check GUI checkpoints
obj_check_gui("progressbar","list1.ck1","gui1",25);
win_check_gui("Report","list1.ck1","gui2",4);

Bitmap Checkpoint statements:
obj_check_bitmap("progressbar","Img1",25);
obj_check_bitmap("statusbar","Img2",25,0,10, 50, 10);
win_check_bitmap("Reports","Img3",4);

Text Checkpoint statements

obj_get_text("Statusbar95",text) ;obj_get_text: retrieves the text within an area

Database Checkpoints

db_check("list1.cd1","dbvf1");

Log Statements

tl_step: lots message in the WinRunner report and changes test status
if (text == "Insert Done...")
tl_step("Check statusbar","Pass","Insert was completed");
else
tl_step("Check statusbar","Fail","Insert Failed");

Statements in Analog Recording Mode
move_locator
move_location_track(1);
move_locator_abs
type("ls\-l");

Analog Synchronization
win_wait_bitmap("Win_1","icon_editor",4, 855, 801, 190, 80);
win_wait_bitmap: waits for a window bitmap to appear onscreen. Bitmap may be full/partial window area. Optionally, bitmap filename may be omitted, thus synchronizing on window refresh/redraw.

Wednesday, September 1, 2010

WinRunner HP Exam Question 2

1. Which WinRunner feature acts as a mediator or translator between the application under test (AUT) and the test script
A. GUI Spy
B. GUI Map
C. WR addin
D. Object Properties
Answer: B

2. Test A and Test B are run in succession. In order for Test B to run successfully, Test A should be designed so that Test B is able to start in the same location where Test A finishes running. What is the best practice for setting up scripts to run in succession or multiple iterations?
A. Data Driving
B. Synchronization
C. Looping Condition
D. Initial and End condition
Answer: D

3. A test script contains standard objects captured in Normal mode, and a window with custom objects captured using Analog mode. Which of the following statements will ensure correct playback of the testscript with steps recorded in Analog mode?
A. The window with custom objects must be visible on the screen
B. The window with custom objects must be centered on the screen
C. The window with custom objects must be in their default size and location
D. The window with custom objects must be in the exact size and location as when they are recorded
Answer: D

4. When a test is run in Update mode, what happens to the expected values defined in a checkpoint that is included in the script?
A. The expected results are transferred to the res folder.
B. The expected results are overwritten in the exp folder
C. The expected results remain the same in the exp folder
D. The expected results are overwritten in the debug folder.
Answer: B

WinRunner HP Exam Questions 1

1. How do you specify a 15-second timeout in the global timeout settings
A. 15
B. 1500
C. 1500
D. 150000
Answer: D


2. You are testing a banking application. At 8AM an employee logs in successfully and it takes about 5 seconds for the main menu window to appear. At 9 AM it takes approximately 15 seconds for the main menu window to appear after login. If you were to incorporate this time difference in a script, which winRunner feature would you use so that the script runs successfully despite the difference in time for the main menu window to appear?
A. Verify
B. Data Drive
c. Synchronize
D. Parameterize
Answer: C

3. Which synchronization statement is automatically generated during recording
A. win_activate("Flight Reservation")
B. set_window("Flight Reservation",10)
C. obj_wait_bitmap("Flights","Img2", 6,7, 8, 101, 114)
D. obj_wait_info("Insert Done...","label","Insert Done...",10)
Answer: B

4. Upon invoking WinRunner, which feature lists the types of applications you can test?
A. Add-In Manager
B. RapidTest Wizard
C. DataTable Wizard
D. Recovery Scenario
Answer: A

5. What is referred to as a WinRunner script that is used to initialize the working environment, including UI_load() and GUI_close_all() statements before test scripts are run?
A. Loader script
B. Startup script
C Function Library
D. Function Generator
Answer: B

6. What does the function move_locator_track() represent?
A. a mouse over
B. a mouse click
C. a keyboard entry
D. a function key press
Answer: A

7. What is the default recording mode that WinRunner uses?
A. Analog
B. Low-Level
C. Standard/Default
D. Context Sensitive
Answer: D

8. During recording, WinRunner "listens" to the actions a user performs on the application (and to the response from the server) and creates a log of these steps. Which language does WinRunner use to create these steps in a script?
A. C Language
B. VBScript Language
C. Test Script Language
D. Virtual User Language
Answer: C

9. In which file does WinRunner store user actions on the application under test captured during recording
A. lock
B. script
C. chklist
D. debug
Answer: B

10. A test script contains both context Sensitive and Analog recording. The scripts keeps failing on the window where the Analog recording is played back. Which function can you include in your script to ensure that windows and objects are in the same locations as when the test was recorded?
A. win_mov function
B. GUI_load function
C. invoke_App function
D. set_window function
Answer: A

12. The process for building a functional winrunner script goes through four steps. What are these steps (select four)
A. plan the test
B. synchronize
C. record steps
D. parameterize
E. Add verification
F. Analyse Results
G. Execute the Test
Answer: BCEG

12. A test run fails because of unrecognized object. You want to compare the actual object properties to the properties stored in the UI Map file. Which winrunner feature compares the actual object properties verses the properties in the GUI map and provides a possible reason for the error?
A. GUI Spy
B. Data Driver Wizard
C. Run Wizard
D. Virtual Object Wizard
E. Rapid Test Wizard
Answer: C

14. How does WinRunner set up the GUI Map file for a new test?
A. WinRunner automatically executes a GUI_load statement.
B. WinRunner automatically loads the last opened GUI Map file.
C. WinRunner automatically creates a new GUI Map file for the test
D. WinRunner automatically load a shared GUI Map file it recognizes.
Answer: C

15. If you want to save your recovery function, where is the best location to save the recovery for every test in your project?
A. Paste the recovery function in each test
B. Add the recovery function in the startup script
C. Add the recovery function in the function generator
D. Recovery Manager saves its own recovery function
Answer: B

15. Which main components must be present in a simple and compound recovery scenario? (Select Two)
A. An Event
B. An Exit function
C. Unknown object
D. Recovery Operation
E. Post-Recovery Operation
Answer: A, D

16. You are asked to create a GUI Map file that contains all the objects in the application under test. What is the best and fastest way to meet this requirements?
A. Use the Run Wizard
B. Use the RapidTest Script Wizard
C. User the Learn feature from the GUI Map Editor
D. Consolidate all GUI Map files into a shared GUI Map file.
Answer: B

17. Select the correct statement about recovery scenarios.
A.. A recovery scenario is manually activated prior to the test run.
B. A recovery scenario works in conjunction with exception handlers in the test script.
C. A recovery scenario can be automatically activated each time WinRunner is launched.
D. A recovery scenario requires an event, recovery operation and post-recovery operation.
Answer: B

18. Which feature do you use to edit an object's property value already saved in the GUI Map file?
A. use the Hand icon of the GUI Spy
B. use the runtime settings in the GUI Spy
C. use the Learn button in the GUI Map file
D. use the Modify button in the GUI Map file
Answer: 4

19. What are considered event types for simple recovery in WinRunner? (Select three.)
A. Crash event
B. Popup event
C. Object event
D. Application event
E. Function return code
Answer: BCE

20. Which element in the test script and GUI Map must be identical for WinRunner to play back on an object successfully?
A. GUI Map file
B. Logical name
C. Parent Window
D. Physical Description
Answer: B

21. When we record a script in analog mode where will it be stored.
Answer: It will be stored in the Temp folder of the winrunner