Although Eggplant Functional is an image-based test automation tool, there are many times when you will work with text in your systems under test (SUTs). Eggplant Functional and the SenseTalk language provide ways for searching for and reading text in your scripts.
When you need to find text, remember that you can capture an image of the text and let your script perform an image search. However, in instances where the text is dynamic or the text value to be searched isn't known ahead of time, Eggplant Functional relies on an optical character recognition (OCR) engine to search the screen for the text string.
There are multiple ways of finding text on the SUT. Here are some of the different ways to find text:
In many cases, you can find text on the SUT the same way you would find any other item on the SUT: by capturing an image of the text and searching for that image in your script. Captured images are easy to use, and very reliable.
Click "HelpMenu" // Finds the image of the Help menu, then clicks it.
For images that contain text, there is a search type setting called Smooth, which accounts for anti-aliased text that might appear in the image. This setting allows for more successful image matches of images that contain text.
Click (imageName:"HelpMenu", searchType:"smooth") // Finds the image of the Help menu using the smooth search type, then clicks it.
For more information about image searches, see Finding Images.
The OCR uses an interpretive algorithm to decipher pixel patterns on the screen, and determine the textual content by comparing what it finds with a dictionary library.
The OCR can be used to either read or find text. To read text off the screen of the SUT using the OCR, utilize a ReadText() function. All of the possible parameters for reading text with the OCR can be found under the documentation for the ReadText() function. To find text with the OCR, pair a Text: parameter with any Eggplant Functional command.
Click (Text:"Help") // Finds the word Help with any appearance, then clicks it.
For more information on how to use the OCR, see Working with Optical Character Recognition (OCR).
Text Considerations for SUT and Data Gathering
You might also need to add text to your SUT. For instance, part of your test might involve filling in fields in a form. For information about adding text with SenseTalk, see Typing on the SUT.
You can also read text from external data files. This ability lets you set up data-driven testing, among other things. To learn about this feature, see Gathering and Using Data.