Thursday, March 15, 2007

Teaching Fonts to WinRunner

In the following exercise you will teach WinRunner the font used by the Flights
Reservation application.
Note that you only need to perform this exercise now if WinRunner did not
recognize text in the previous exercise. In general, you only need to teach fonts
to WinRunner if it does not automatically recognize the fonts in the application you
are testing.
To teach a font to WinRunner you:
• learn the set of characters (font) used by your application
• create a font group, a collection of fonts grouped together for specific testing
purposes
• activate the font group by adding the setvar TSL function to a test script

Learning Fonts
You use the WinRunner Fonts Expert to learn the fonts used by your application.
1 Start WinRunner and open a new test.
If WinRunner is not already open, choose Programs > WinRunner >
WinRunner on the Start menu. If the Welcome window is open, click the New
Test button. Otherwise, choose File > New. A new test window opens.
2 Open the Fonts Expert.
In WinRunner, choose Tools > Fonts Expert. The Font Expert window opens.
3 Open the Learn Font window.
In the Fonts Expert, choose Font > Learn. The Learn Fonts window opens.
4 Name the font in the Flight Reservation flights.
In the Font Name box, type flights.
5 Describe the properties of the flights font.
Click the Select Font button to open the Font dialog box. The Flight Reservation
font is MS Sans Serif, Bold, 8 points. Select these properties in the window and
click OK.
6 Learn the flights font.
In the Learn Font window, click the Learn Font button. When the learn process
is completed, the Existing Characters box displays the characters learned and
the Properties box displays the font’s properties.
7 Close the Learn Fonts window.
Click Close.

Creating a Font Group
After WinRunner learns a font, you must assign it to a font group. A font group can
contain one or more fonts. In this exercise you will create a font group which
contains only the flights font.
1 Open the Font Groups window.
In the Fonts Expert, choose Font > Groups.
2 Create a Font Group called flt_res and assign the flights font to it.
Type the name flt_res into the Group Name field. Select "flights" in the Fonts in
Library box. Click the New button.
3 Close the Font Groups window and the Fonts Expert.
Click Close.
4 Close the Fonts Expert.
Choose Font > Exit.

Activating a Font Group
The final step before you can read text is to activate the font group. You do this in
the General Options dialog box.
1 Open a blank test window in WinRunner.
If a blank test window is not currently open, choose File > New.
2 Activate the flt_res font group and the Image Text Recognition mechanism.
Choose Settings > General Options. In the General Options dialog box, click
the Text Recognition tab. Select the Use Image Text Recognition Mechanism
check box. In the Font Group box, type flt_res, and click OK.