Eggplant Functional Global Properties
The Eggplant Functional global properties pertain to running SenseTalk scripts from the Eggplant Functional application specifically. However, keep in mind that the general SenseTalk global and local properties are also useful in Eggplant Functional scripting. (For example, The ColorFormat
global property.)
In addition to the application-specific properties described below, SenseTalk also includes Run Options global properties for Eggplant Functional that pertain to interactions with a system under test (SUT) in the course of a test run.
Many of these global properties appear in the Text and Run preferences in Eggplant Functional (Eggplant > Preferences). Using them as global properties lets you change them on a script-by-script basis, or even multiple times within a single script. Changing the value of a property within a script affects that value for that runtime, but does not change the value set in the application preferences.
For general information about using local and global properties, see Local and Global Properties in SenseTalk.
The CaptureScreenImageFormat
Global Property
Values: PNG
, JPG
, or TIFF
Default: PNG
Behavior: Modifies the image file format used by the CaptureScreen
command when capturing screenshots during a test run.
Example:
set the CaptureScreenImageFormat to JPG
The CaptureScreenJPGCompressionQuality
Global Property
Values: Integer between 1
-100
Default: 100
(no compression; as lossless as possible)
Behavior: Adjusts the compression quality of JPG formatted screenshots captured by the CaptureScreen
command. The number indicates the percentage of image quality that is preserved during image compression; 1
being a much lower quality image with a higher amount of image data loss, and 100
meaning that the compression preserves as close to 100% of original quality as possible.
Example:
set the CaptureScreenJPGCompressionQuality to 75 -- Reduces the compression quality, making the file even smaller, but sacrificing some image clarity
The CaptureScreenScaleFactor
Global Property
Values: Decimal value between 0 and 1.
Default: 1 (full size)
Behavior: Scales images captured by the CaptureScreen command proportionally. Setting the ScaleFactorForCaptureScreen
to .5, for instance, will cut the image dimensions (both height and width) of the screenshot captured in half, before it is saved. So, a 1000x1000 pixel image will be cut to 500x500 px.
This functionality is specific to images captured by the CaptureScreen command, and is different from the Scale Factor used with image searching. For more on how to scale captured images for search purposes, see Image Scaling on the Finding Images page, or The ScaleFactors
Global Property.
Example:
set the CaptureScreenScaleFactor to .5 -- This will cut the scale of the image in half
The CollectionFilter
Global Property
Values: A property list that contains one or both of the properties Name
and Description
Default: No filter
Behavior: Limits image searches to those images whose names or descriptions contain the specified string.
To set a description for an image, use the image viewer in the suite.
Example:
Set the CollectionFilter to (Name: "English", Description: "release 5.0")
Example:
params SUTOS
If SUTOS is "iOS"
set the CollectionFilter to (Name:"iOS")
else if SUTOS is "Android"
set the CollectionFilter to (Name:"Android")
end if
To reset the CollectionFilter
, set the value to empty.
Example:
Set the CollectionFilter to empty
The CommandLineOutput
Global Property
Values: True
(or On
, or Yes
), False
(or Off
, or No
)
Default: False
Behavior: The CommandLineOutput
controls the output of messages to the standard output stream when a script is run from the Unix or Windows command line:
- Off: No output is sent to standard output (stdout).
- On: All of the script output that would appear in the Eggplant Functional graphical interface is sent to the standard output stream.
Example:
Set the CommandLineOutput to On
Example:
SetOption CommandLineOutput, Off
The CommandLineOutput
is also available as a runscript command line option.
The CompareScreenAction
Global Property
Values: ShowPanel
, LogWarning
, LogError
, or ShowPanelAlways
Abbreviated terms that distinguish between the settings are also allowed: Panel
, Warning
, Error
, or Always
Default: ShowPanel
Behavior: This global property controls the action performed when you run a CompareScreen
command. You can use this property to change the behavior within a script run. The available options are:
ShowPanel
: If a screen difference is detected, the Compare Screen panel opens.LogWarning
: If a screen difference is detected, a warning message is entered in the log.LogError
: If a screen difference is detected, an error message is entered in the log.ShowPanelAlways
: The Compare Screen panel opens regardless of whether any screen difference is detected.
Example:
set the CompareScreenAction to "Always"
Example:
BeginTestCase "Detect Full Screen Differences"
// Set the compare screen global property to not show the panel and log a warning
set the CompareScreenAction to "LogWarning"
Log "Verify the rectangle captured is found as expected before changing it"
click "Contacts" -- To set the tutorialSut back to its default screen
CompareScreen Name:"tutorialSutMenus"
Log "Now let's change the tutorial Sut screen"
Click "Favorites"
Log "...and run CompareScreen again"
CompareScreen Name:"tutorialSutMenus"
EndTestCase "Detect Full Screen Differences"
Related:
The CurrentCharacterCollection
Global Property
Values: Empty, or the name of a character collection
Default: Empty
Behavior: This property lets you set a default character collection for image searches that use the character
property (i.e., searches intended for a character collection). When you set a value for the currentCharacterCollection
, you can omit the characterCollection
property from character
searches. You can also omit the characterCollection
property from a readCharacters
function call. Supplying the name of the character collection toreadCharacters
or with a characterCollection
property overrides the value of the currentCharacterCollection
global property.
Example:
set the currentCharacterCollection to "iPhoneCharacters"
Related:
- [ReadCharacters](stk-ocr-text-reading-functions.md#readchar)
- Working with Character Collections
The DefaultCaptureScreenSize
Global Property
Values: A list of values representing the width and height of the SUT at time of image capture. Given as (width
,height
).
Default: Empty
Behavior: The DefaultCaptureScreenSize
sets the default screen size of the SUT at time of image capture for any images captured prior to Eggplant Functional v12.20. This is for use with Dynamic Scaling in image searches. For more information see Dynamic Scaling.
Example:
set the DefaultCaptureScreenSize to (1024,768)
The DefaultUseMarkup
Global Property
Values: True
(or On
, or Yes
), False
(or Off
, or No
)
Default: False
Behavior: The DefaultUseMarkup
determines whether or not supported text markups are recognized in the Text property of a text property list. When the DefaultUseMarkup
is set to yes
, supported markups are used to format generated text images. When the DefaultUseMarkup
is set to no
, markups are treated as literal text. (Markups are always treated as literal text for text platforms that use the OCR text engine.)
Example:
set the defaultUseMarkup to No
Example:
setoption DefaultUseMarkup, Yes
The FinalSuites
Global Property
Values: One or more suite names
Default: None
Behavior: The FinalSuites
global property determines the suite or suites that are searched for script or image resources after the script's own suite is searched. (Suites named in the InitialSuites
are searched first, followed by the script's own suite, and then the FinalSuites
.)
Example:
Set the FinalSuites to ("FallBack") //Sets the FinalSuites to a suite named "FallBack"
Example:
set the FinalSuites to the folder of SuiteInfo().Path & "common.suite"
The FinalSuites/InitialSuites
searches the default suite directory for the suite(s) specified with the global property. If the suite(s) are not present in the default suite directory, you must reference the suite by its full file path.
Example:
set the FinalSuites to "C:\AutomationScripts\common.suite"
The FinalSuites
behaves similarly to helper suites in that both the FinalSuites
suites and helper suites are searched after the script's own suites are searched.
The ForceScreenRefresh
Global Property
Values: True
(or On
, or Yes
), False
(or Off
, or No
)
Default: False
Behavior: The ForceScreenRefresh
determines whether Eggplant Functional refreshes the Viewer window after each command.
The ForceScreenRefresh
is rarely necessary, and dramatically slows down script execution. However, it might be helpful with a SUT that is generating a lot of screen artifacts or running software that does not display well through the VNC server.
Example:
SetOption ForceScreenRefresh, true
The HotSpotScaling
Global Property
Values: Inner
, All
, or None
Default: Inner
Behavior: This property determines whether image hot spots are scaled when you search for a scaled image. The values are as follows:
- Inner: If a hot spot is within the searchable pixels of an image, it is scaled with the image. If the hot spot is offset from the image, it is not scaled.
- All: Hot spots are always scaled proportionally when you search for a scaled image.
- None: Hot spots are not scaled when you search for a scaled image.
Example:
Set HotSpotScaling to None
Example:
params SUTType
If SUTType is "mobile" then set the HotSpotScaling to All //Sets the HotSpotScaling to All if "mobile" is passed in as the SUTType parameter value
The HotSpotScaling
is particularly relevant when performing image scaling, which is commonly used in cross-mobile testing.
The ImageUpdate
Global Property
Values: Auto
, Manual
, or Off
Default: Manual
Behavior: The ImageUpdate
global property determines how the Image Update panel and OCR Update panel behave during script execution:
- Auto: The Image Update and OCR Update automatically attempt to correct image and OCR failures and continue the script execution. The initial image or OCR failure is logged as a warning and any corrective action is also logged as a warning. Changes are cached but not committed until the script is updated (OCR) or the change is applied (images) using the Action drop-down list in the Results for the particular script run.
- Manual: The Image Update panel and OCR Update panel open when an image or OCR search fails; you can choose to proceed with a corrected image or OCR search, or allow the script to fail. The amount of time the Update panel remains open is adjustable on the System Pane of the Run Option preferences in Eggplant Functional. Manual is effective only when you are running scripts in the Eggplant Functional GUI.
- Off: The Image Update panel and OCR Update panel are not used during script execution. This allows scripts to fail more quickly in the event that an image or OCR search is unsuccessful.
Example:
Set the ImageUpdate to Manual
Example:
SetOption ImageUpdate, Off
Related:
the ValidateImageFound
This command is used in place of the ImageDoctor global property, which is deprecated.
The InitialSuites
Global Property
Values: One or more suite names
Default: None
Behavior: The InitialSuites
global property determines the first suite or suites that are searched for script or image resources called by the current script. (Suites named in the InitialSuites
take precedence over the calling script's own suite.)
Example:
Set the InitialSuites to ("Windows8Common", "Windows8Calculator")
Example:
Params SUTModel
if SUTModel contains "iPhone" or SUTModel contains "iPad" then
set the initialsuites to "NopCommerceiOS.suite"
else
set the initialSuites to "NopCommerceAndroid.suite"
end if
The InitialSuites/FinalSuites
searches the default suite directory for the suite(s) specified with the global property. If the suite(s) are not present in the default suite directory, you must reference the suite by its full file path.
Example:
set the InitialSuites to "C:\AutomationScripts\NopCommerceAndroid.suite"
The OpenTestCases
Global Property
Values: A property list of results property lists. For example:
(@"Login.script":(Errors:"0", Exceptions:"0", StartTime:"2016-10-10 16:02:20 -0600", Successes:"0", TestCase:"Login.script", Warnings:"0"), WelcomeLoadTime:(Errors:"0", Exceptions:"0", StartTime:"2016-10-10 16:02:20 -0600", Successes:"0", TestCase:"WelcomeLoadTime", Warnings:"0"))
Default: Empty
Behavior: The OpenTestCases
global property is used to access information gathered up until that point by all open test cases (see The BeginTestCase and EndTestCase Commands for information about what a test case is).
The initial handler (the script itself) is considered a test case and will be reported as one by the OpenTestCases
global property. If no declared test cases are open, the script (initial handler) will be reported as the only open test case.
Example:
BeginTestCase "WelcomeLoadTime"
//Execute some actions
log the OpenTestCases //Accesses information about the current test cases
//Execute further actions if desired
EndTestCase "WelcomeLoadTime"
log the result //Logs the results property list for the test case after it has ended
The result property list created by a test case can be accessed after the test case has been closed by using the result
. This action must be done immediately following the EndTestCase
command that closes the case, as shown in the example above.
The MultipleFoundAction
Global Property
Values: UseFirstLocation
, ShowPanel
, LogWarning
, or ThrowException
. These values can be abbreviated as First
, Panel
, Log
, and Throw
, respectively.
Behavior: Can be used at runtime to override the setting set in Run > Image Update > When Multiple Occurrences Are Found.
Example:
set the MultipleFoundAction to LogWarning
The ReadTextSettings
Global Property
Values: A property list
Behavior: The ReadTextSettings
is a property list of the default settings used for the ReadText()
and ReadTable()
functions.
Example:
Set the readTextSettings to (dpi:96, multiLine: off)
Example:
set Characters to "A".."Z" &&& "a".."z" &&& comma // Stores all uppercase and lower case letters as well as , as a list into a variable
set the readTextSettings to (validCharacters:Characters) // Uses the list inside Characters to indicate the ValidCharacters
Example:
if param(1) is "Phone" then // Param(1) refers to the first parameter value passed into the script
set the ReadTextSettings to (DPI:200)
set the HotSpotScaling to all
set the defaultScale to .5
end if
log readText("StatusUpperLeft","StatusLowerRight") //This and subsequent readText and readTable functions will use dpi:200