Friday, July 4, 2008

Winrunner - Tooltip verification

Winrunner does not have any built-in function, to get tooltip. Jerry McGowan has written TSL code to verify the tooltip. I was searching my old winrunner scripts. At that time, I found this sample code.

Already I have written a post for tooltip verification by QTP. Post QTP - Tooltip verification in Browser

Winrunner (TSL) code - To verify Tooltip

############################################################ # Function: # check_tootip() # # Description: # Moves the mouse to a specified location within an object # to activate the object popup text message. The expected # popup message is then compared to the actual text, and # the function returns E_OK if the text is found. # # Parameters: # object - Name of the object # tip - The expected tip text that should popup when # the mouse is moved over the object. # x - The x position within the object to move the mouse # y - The y position within the object to move the mouse # # Returns: # "E_OK" if the tip is found, "E_NOT_FOUND" otherwise. # # Syntax: # rc = check_tooltip(object,tip,x,y); # # Example: # check_tooltip("ToolbarWindow32","Create Order",5,5); # ############################################################ function check_tooltip(in object, in tip, in x, in y) { auto parent, text; # Move to the first button of the toolbar obj_mouse_move (object, x,y); # Wait until the tip is displayed. wait(1); # Get the text for the window. obj_get_info(object,"parent",parent); win_get_text(parent, text); # You can then search the contents of text to see if # the expected tip is displayed. if (index (text, tip) > 0) { tl_step ("Tool tip", PASS, tip); return (E_OK); } else { tl_step ("Tool tip", FAIL, tip); return (E_NOT_FOUND); } }; ############################################################ # End of script ############################################################

No comments: