The Eggplant Functional virtual user (VU) automatically passes values from its data dictionary to the Eggplant Functional script run using
In the SenseTalk script, the data becomes available as a global property list called
performance_data at the start of every iteration. This means individual rows from data sources with multiple rows are passed to the Eggplant Functional script on different iterations, the same way any other normal VU type has different rows in its data dictionary each iteration. For more information about data dictionaries, data sources, and iterations, see The Virtual User Data Dictionary.
The property list is also updated when the user modifies the VU data dictionary using
If the user changes the
performance_data property list in SenseTalk while the Eggplant Functional script is running, the changed values are loaded into the VU data dictionary after
RunWithNewResults(), so they are available to any other Eggplant Functional scripts in the same workflow.
Eggplant Performance Java Script
The following Java script example shows a
setString() statement that would update the
performance_data property list in SenseTalk and call the Eggplant Functional script with
public void script() throws Exception
// This isn't needed if a data binding is set up with this username in a data source
// Run the eggPlant Functional script
Eggplant Functional SenseTalk Script
Within the Eggplant Functional script called by the Java script, you could use the following SenseTalk to type text in an input box according to what was stored in the VU's data dictionary:
TypeText global performance_data.username
With the Java example above, this would type "Fred."
Setting a Value in the Property List in the Eggplant Functional SenseTalk Script
The following example SenseTalk would read some text from the screen and store it in the
performance_data property list, making it available to the Eggplant Performance VU after the Eggplant Functional script finishes executing:
put ReadText ("TLImage", "BRImage") into global performance_data.customerID
In this case, the Java code in the Eggplant Performance script can write the customer ID as a message which can be viewed in the event log viewer in Test Controller:
writeMessage(String.format("customerID set to %s", getString("customerID")));
Setting Eggplant Functional Suite Variables from Eggplant Performance
Suite variables in Eggplant Functional are user-defined local variables that are defined on a per-suite basis. You can update suite variables from your Eggplant Performance tests.
For more information on Eggplant Functional suite variables, see Creating and Using Suite Variables.
Suite variables can be updated from Eggplant Performance in two ways:
- By setting up a data binding where one or more of the keys (either table column or dictionary key) starts with
- By calling
setString("suiteVariables.myKey", "myValue")in an Eggplant Performance Eggplant Functional Java script before calling
This capability can be useful if you're working with an Eggplant Functional suite that has scripts that already use suite variables, and you need to set or update the suite variables from Eggplant Performance.