SenseTalk is the English-like scripting language that is used to develop Eggplant Functional scripts. This page discusses the most common SenseTalk functionality used by Eggplant Functional for testing purposes. Further learning resources are provided below. For an introductory description of the SenseTalk language and the philosophy behind it, see About SenseTalk.
You might notice that the SenseTalk language is displayed using colors, with individual elements shown in different colors. This is to aid in writing the scripts. Lines of code written in correct syntax are colored, while invalid syntax is not colorized. Colors can be modified in the Eggplant Functional Script Preferences.
Command and Function Basics
Commands and functions are used similarly, but there are some significant differences:
- Functions always have return values; commands
mighthave return values.
- Functions are typically used as parameters to commands.
- Commands must be written alone, not as part of a statement; functions must be part of a statement.
- Separate command and function parameters with commas: Example:
Click "SomeImage", "SomeOtherImage"
- Enclose function parameters in parentheses: Example:
Data Types Used in Eggplant Functional Commands and Functions
Commands and functions in Eggplant Functionaluse a variety of data types: numbers, coordinates, strings, and property lists.
Single numbers passed as parameters are not enclosed in quotation marks or parentheses.
Time parameters are measured in seconds, unless you indicate otherwise. SenseTalk understands the terms
Wait 1 minute 15 seconds
When numbers are given as coordinates, they are enclosed in parentheses.
Eggplant Functional also allows vector arithmetic to generate a location relative to a known position.
Click ((30,35) + (100,5))
Click (ImageLocation("SomeButton")+ (100,5))
Strings, such as file names and text literals, are enclosed in quotation marks.
TypeText "Here is some text."
Note: Double angle-brackets << >> can enclose text that contains quotation marks and large blocks of text with return characters.
Property lists define or identify objects by listing certain properties. Each property comprises a key, which identifies what the property represents, and a value, which defines the property for the object.
Click (ImageName: "MenuButton", HotSpot: (10, 23))
The example above describes an image that is the same as the saved image called MenuButton, but with a different hot spot location: (10,23). The key
ImageName represents the saved image that this property list is based on. The value of ImageName is MenuButton, the actual name of the image.
Property lists are always enclosed in parentheses, with a colon between each key and its value. Quick Reference: Property Lists contains tables of the types of property lists used in Eggplant Functional. For more information, see Property Lists.
Further Learning about SenseTalk
See the SenseTalk Reference for information to help you gain a thorough understanding of SenseTalk and how to use it.
Topics covered in the SenseTalk Reference include:
- About SenseTalk: An overview of SenseTalk and how it works.
- Key Elements: A one-hour introduction to SenseTalk for experienced programmers and inquiring minds.
- The Basics: To use SenseTalk effectively, you'll need to understand values, containers, expressions, and control structures.
- Objects and Messages: Gain a thorough understanding of messages and handlers, and objects and their helpers.
- Working with Databases: Read the following information to better understand how you can use SenseTalk scripting to work with databases.
- Commands and Functions: Learn how to manipulate text, perform calculations, and more.
- GUI Automation Commands and Functions: SenseTalk methods for interacting with systems under test (SUTs). You can provide mouse or keyboard commands, search for images, or control connected mobile devices.
- Local and Global Properties: In SenseTalk, local and global properties are system-wide values that determine behaviors of the run environment.