Tuesday, March 13, 2007

How Do You Read Text from an Application?

You can read text from any bitmap image or GUI object by adding text checkpoints to a test script. A text checkpoint reads the text from the application. You then add programming elements to the test script, which verify that the text is correct.
For example, you can use a text checkpoint to:
• verify a range of values
• calculate values
• perform certain operations only if specified text is read from the screen
To create a text checkpoint, you indicate the area, object, or window that contains the text you want to read.
WinRunner inserts a win_get_text or obj_get_text statement into the test script and assigns the text to a variable. To verify the text you add programming elements to the script.
Note that when you want to read text from a standard GUI object (such as an edit field, a list, or a menu), you should use a GUI checkpoint, which does not require programming. Use a text checkpoint only when you want to read text from a bitmap image or a non-standard GUI object.
In the following exercises you create a test that:
. opens a graph and reads the total number of tickets sold
. creates a new order for the purchase of one ticket
. opens the graph again and checks that the total number of tickets sold was updated
. reports whether the number is correct or incorrect