About Checking Text - WinRunner

You can use text checkpoints in your test scripts to read and check text in GUI objects and in areas of the screen. While creating a test you point to an object or a window containing text. WinRunner reads the text and writes a TSL statement to the test script. You may then add simple programming elements to your test scripts to verify the contents of the text.
You can use a text checkpoint to:

  • read text from a GUI object or window in your application, using obj_get_text and win_get_text
  • read text from a GUI object or window in your application and compare it to expected text, using obj_check_text and win_check_text
  • search for text in an object or window, using win_find_text and obj_find_text
  • move the mouse pointer to text in an object or window, using obj_move_locator_text and win_move_locator_text
  • click on text in an object or window, using obj_click_on_text and win_click_on_text
  • compare two strings, using compare_text

Note that you should use a text checkpoint on a GUI object only when a GUI checkpoint cannot be used to check the text property. For example, suppose you want to check the text on a custom graph object. Since this custom object cannot be mapped to a standard object class (such as pushbutton, list, or menu), WinRunner associates it with the general object class. A GUI checkpoint for such an object can check only the object’s width, height, x- and y- coordinates, and whether the object is enabled or focused. It cannot check the text in the object. To do so, you must create a text checkpoint.

The following script segment uses the win_check_text function to check that the Name edit box in the Flight Reservation window contains the text Kim Smith.

WinRunner can read the visible text from the screen in most applications. Usually this process is automatic. In certain situations, however, WinRunner must first learn the fonts used by your application. Use the Learn Fonts utility to teach WinRunner the fonts. For an explanation of when and how to perform this procedure, see “Teaching Fonts to WinRunner”


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WinRunner Topics