Global Properties for SenseTalk Variables

SenseTalk includes several global properties that let you control how you can access and work with variables in your scripts.

For information about working with variables in SenseTalk, see Variables.

For additional information about working with local and global properties, see Local and Global Properties in SenseTalk.

Related Global Property

SenseTalk includes a related global property as part of the properties that are specific to working with scripts in Eggplant Functionall. the suiteVariables property lets you set or modify suite-wide variables that act as predefined local variables. For complete information about the suiteVariables, see Eggplant Functional Global Properties.

the predefinedVariables Global Property

Values: A property list containing definitions of variables

Default: For a list of current predefined variables, see Predefined Variables Provided or run the following command:

put the predefinedVariables

Behavior: This property is a property list containing the definitions of all the predefined variables. Any changes made to this property affect any subsequent use of an unassigned variable whose name is one of its keys. By modifying this property, predefined variables can be created or removed during a run, or their value can be changed.

Example:

set the predefinedVariables.twelve to "⓬"

put twelve // ⓬

Example:

log checkMark repeated 5 times // Logs '✓✓✓✓✓'

set the predefinedVariables's checkMark to "☑"

log checkMark repeated 5 times // Logs '☑☑☑☑☑'

the evaluationContext Global Property

Values: Local, Global, Universal

Default: Local

Behavior: This property determines the scope of variables in do, send, value(), and merge() expressions. Local variables have the context of a single handler in a script. Global variables can be referenced from any handler within a project, and they retain their value between different handlers. Universal variables retain their values between runs during an entire session.

Example:

set the evaluationContext to "global"

Example:

set global myName to "Carrie"

put merge("My name is [[myName]]") // Displays 'My name is myName'

set the evaluationContext to "global"

put merge("My name is [[myName]]") // Displays 'My name is Carrie'

the strictVariables Global Property

Values: True, False

Default: False

Behavior: This property lets you set a rigorous evaluation of undeclared local variables. With the default value of False, attempting to access an undeclared or unused variable treats it as an unquoted literal (that is, the value of the variable initially is the same as the name of the variable). If you set the strictVariables to True, any attempt to access a variable that has not been explicitly declared or assigned a value throws an exception rather than returning the variable’s name.

Example:

set the strictVariables to true

Example:

log SUTName // Logs 'SUTName'

log BrowserName // Logs 'BrowserName'

set the StrictVariables to true

log SUTName // Throws exception 'StrictVariablesViolation Variable 'SUTName' used without being set'

Example:

set the StrictVariables to true

set SUTName to "WindowsVM"

Connect SUTNme // Throws an exception; helpful for finding typos in variable names

Related:

 

This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant