Text Image Generators

Here’s our situation. We are testing on a SUT running SUSE Linux 9 and soon SUSE Linux 10, and of course we’ll upgarde to SUSE Linux 11, etc. as time goes on. There will be slight font changes as these upgrades occur which have the potential to require us to retake many images.

So the obvious solution is to use the text image capability. However, I can’t even get the pango solution to find a an image in Konsole in KDE. I see two things that sound promising but there is almost no documentation. One is to have a remote TIG. I’m concluding that this requires that you’re testing on Windows using the provided TIG server with the Eggplant dmg. The other solution is to run a script.

I have two questions/requests.

  1. Can you document the remote TIG protocol so that we can create our own TIG server that will run on both of our SUT platforms?
  2. Can you document the script command so that we know how to write a script that will retrieve the text images?
  1. There’s not much to document. You need to be able to send the TIG a text string via the specified port and receive an image back. The hard part is coding to the specific rendering engine that is used by the application(s) that you want to test. I’m looking into whether we can provide any more specific information regarding the communication API.

  2. In pseudocode it would look something like this:

open the text editor on the SUT (the editor should use the same font rendering engine as your app does)
define the rectangle of the text area (can just be opposite corners of the text editing area and done with images)
set the text properties to match those used by your app
type the text that you want to match
use the captureTextImage command to capture an image of the text (use the previously defined rectangle and the text properties)

This will put the image in the textImages folder of the suite. The image is automatically cropped to the text. You can then use a text image property list in a command and Eggplant will use the saved image if you use the same property list that was used when the image was captured.

More information on the communication protocol would be helpful. A request that’s a string and a reply that’s binary data in the form of an image would make sense. However, how is the string formatted? How are the font, size, color, etc. passed in that string?

Same question for the scripts. On the script line you can put whatever you want. Say I had a script called “tig”. If I just put in “tig”, how would the font name, size, color, etc. be passed in? Would I need to put something like “tig $fontname $fontcolor” as the script in the configuration?

I’m still waiting on information about the parameters that are passed to the TIG.

As for the script, nothing is passed with the string. You launch a text editor on the SUT and set the text properties of that text editor to match those of the text in your application. So your script would need to, for example, click the Format menu; then the Text menu item; and then select the correct font, size, bold, italic, etc. settings. Then you can do a TypeText command with the string that you are going to need to look for, followed by the captureTextImage command. Then to generate the next string, you would first need to delete the current one (i.e., select all, delete), and repeat the TypeText/captureTextImage sequence until you had all the text images that you needed. If you had more than one text style, then you would also have to repeat the process of setting up the text format.

All that is really being done for you here is the cropping of the text image and the creation of textimage folders in the Suite. If the set of text that you are going to be looking for isn’t going to be changing, then it would actually be quicker to use the standard image capture approach. But the captureTextImage process, while somewhat cumbersome, still allows a degree of dynamism that standard image capture does not. You can parameterize the process so that you can feed it values from a text file and generate text images for whatever values the file contains.

Need to amend my previous post: You can actually specify the script as the target of the text platform in the Eggplant preferences. If you do that, then when you refer to a text image in your test script, if the text image doesn’t already exist in the cache, Eggplant will call the TIG script and pass it whatever text properties were provided as a plist. The TIG script can then access those properties and if it’s parameterized to do so, set the text editor to use those properties for new text.

Since this means that each time you call the TIG script, you’ll need to access the text editor, you might want to have the TIG script connect to a different machine than the one being used as a SUT. Otherwise you’ll need for the TIG script to either launch/close or show/hide the text editor. Of course, if the TIG script connects to a different machine, then you’ll want to restore the SUT connection at the end of the TIG script. The would look like this:

-- store the current connection settings
put connectionInfo() into SUT_ci
-- now connect to the TIG machine
connect TIG_target
-- code here generates the text image
-- now reconnect to the SUT
connect SUT_ci

OK. So I would need to have a different VNC session set up to handle these kind of requests. This sounds like a less robust solution than the remote TIG solution, but I’ll keep it in mind in case the remote solution doesn’t work once I get the specification.

Old topic, but I wanted to point out that we have posted basic instructions for writing your own external Text Image Generator on the website here: Writing a TIG