Find image and text image

I’m wondering whether we are allowed to instruct Eggplant to search for both image and text image withint the same statement. For example,

set CurrentTextPlatform = "WindowVista"
WaitFor 8.0 "Linux_Image", (Text:"Image", TextStyle:"WindowTitle")

These codes are supposed to look for an image on 2 platforms (vista and linux). Currently an image is captured on Linux, whereas on Vista, the same image is detected with dynamic text image. Is the above line allowed?

In Eggplant Preferences, WindowVista is set as default text platform. When I ran this code, it said that “Text Image Server unable to write image into text image generator”.

In order to remove this error, I set default text platform to Linux then re-ran the script. But it is my intention to keep Vista as my default text platform, yet hpoing that Eggplant is able to execute the codes above correctly…is this possible? Please advice.

Yes, that line is perfectly valid and even encouraged for exactly the scenario you described.

The error you got basically was saying that it couldn’t communicate with the Text Image Generator at that time to generate the Vista image. So I would go back to your Text preferences and check the Generator section. If it was set to Current SUT then you may need to choose a dedicated TIG server (otherwise when you are running that script with a Linux SUT it won’t be able to connect).

Please let us know if that doesn’t make sense or if you have additional questions.

The default text platform is Window Vista. The generator for Window Vista is set to External (Windows), with the host set to “active connection” and port to 5899.

My script is written in such a way to run on both Vista and Linux platforms. It will receive a parameter from its caller to determine the platform, which in turn will set the value of CurrentTextPlatform.

Let say now we want to run on Linux platform. Since the waitfor statement can detect any of the 2 images (normal image or text image), it is my intention that it will be able to use text image for Vista testing, and use “Linux_Image” for linux testing.

set CurrentTextPlatform = "LinuxRHE" 
WaitFor 8.0 "Linux_Image", (Text:"Image", TextStyle:"WindowTitle")

If I want to perform test on Linux, I observe I need to manually reset LinuxRHE as my default text platform in Eggplant Preferences before running the test. This way can make sure that the error “Text Image Server unable to write image into text image generator pg-rhe5-32-1” can be bypassed. And it managed to detect Linux_Image successfully instead of using text image.

It looks like the code

set CurrentTextPlatform = "LinuxRHE"

didnt help to choose the right text platform for me in the event if I’ve more than a text platforms setup in Eggplant. Can we overwrite the default text platform set in Eggplant Preferences in our test script? I don’t think resetting default text platform manually in Eggplant Preferences before running a test is a good approach here.

Please advice. Thanks.

You can set this property as a global property by proceeding the property name with “the”. That goes for all global properties.

set the CurrentTextPlatform to "WindowVista"

You can also set this property with “SetOption”. Whatever you prefer.

Ooops, I made a mistake previously…thanks for your pointer :slight_smile:

I’ve added a new text platform in Eggplant preferences - LinuxRHE. I tried to set my current text platform to LinuxRHE with the statement below:

set the CurrentTextPlatform to "LinuxRHE"

This statement cannot be executed correctly, I encountered the error below and the script execution suspended:
Unable to set CurrentTextPlatform to LinuxRHE. No corresponding platform in TextPlatforms

It mentioned about the TextPlatforms. Can I assume that this should be the text platforms that I defined in Eggplant Text Preferences? Does this error has anything to do with file/directory permission?

Please advice.

Ai Choo

What version of Eggplant are you attempting this with? Also, have you verified that the spelling of your text platform under your Eggplant Text Preferences exactly matches the name of the platform that you are referencing in your script?