Using Data Sources in Eggplant Performance
Data sources are used in Eggplant Performance to parameterize test execution. That is, unique or common data can be provided to each virtual user (VU) participating in test execution. For example, in a test where each VU must log on to the system under test (SUT) every VU could be set up with a unique log-in name parameter.
The Data Source View
Data sources for Eggplant Performance are either name=value pairs (a dictionary) or a data table. To view information about a data source, select the data source located in the Data Sources folder in the Project tree.
The bottom of the Viewer pane changes depending on the type of data source you select:
- Name=Value Pairs: If you select this type of data source, the Viewer pane displays a preview of the Data dictionary contents.
- Data Table: If you select this type of data source, the Viewer pane displays a preview of the Data table contents.
To edit the data dictionary contents, right-click on a data entry and use the context menu to make changes. You can also double-click a column or press the F2 key while a column has focus to make changes. The buttons marked with the purple rectangle below provide a handy way to edit the data dictionary contents:
Editing a data dictionary in Eggplant Performance Studio
To edit the data table contents, right-click on a data entry and use the context menu to open the data file You can also use the buttons marked with the purple rectangle below:
Editing data table contents in Eggplant Performance Studio
After selecting a data source, click the Data Bindings tab to view a list of tests that contain a data binding to the selected data source. Click the File Properties tab to view the data source file properties.
Follow the links below for more information about each data source:
VUs also can access a data source known as the global variables per test.
Troubleshooting Scripts by Logging Data Values
There are times when you might need to log the data from the data bindings shown in the Data Source view to troubleshoot your scripts. This logged information helps you find out exactly what data a virtual user has assigned to it at a particular time. In turn, this logged information lets you see if the data is what's expected and/or why it isn't working.
To set up this logging, include the following command inside a method within your script code: LogCurrentDataValues();
Now when you run a test in the Test Controller that includes this script code, the virtual user writes a message to the event log containing all the keys and their associated values that the virtual user is currently using. This message includes values from both data dictionary bindings and data table bindings. Depending on the data binding options, data table bindings might change for each iteration as new data rows are loaded.