Data Table File Sources in Eggplant Performance
Data tables in Eggplant Performance are useful for assigning different rows of data to different virtual users (VUs). For example, each VU might require a unique login name for the system under test (SUT), or multiple unique rows of data in order to perform multiple iterations.
When multiple VUs request the same key, they receive different values unless data rows are being recycled, in which case data might be duplicated across VUs.
Formatting a Data Table
A data table consists of a header row containing column names delimited by either commas or tab characters. Subsequent rows in the data table comprise actual data matched to the column headings. The delimiter for the data rows must match the delimiter for the data column headers.
surname,accountNum,postCode
dawson,56298167,PR5 1FG
johnson,66771054,WC1 8XH
marshall,00418890,LE7 5HG
emerson,51738216,SP3 7WT
If data in the table needs to contain the delimiter character (i.e., a comma or a tab character), then you need to enclose the data value in double quotes. If data in the table needs to contain a literal double quote character, use two double quote characters together.
title,quote
Star Wars,"Use the Force, Luke!"
"O Brother, Where Art Thou?",Is that ""Babyface"" Nelson?
Adding a Data Table File Source to a Project
There are several options for adding data tables to a project:
Create a New Data Table
-
Right-click the Data Sources folder in the Project tree and select New data source.
-
Select Create new data table file to create a new data table file source and click Next.
-
Enter a Data Table Name for the new data table.
-
Select the File Type and click OK. The new data table file source is added to the Project tree in the Data Sources folder.
Create a Data Table from a Recording
-
Open the Recordings folder in the Project tree.
-
Select a recording, then right-click the recording and select Create data source. You also can select a recording, then go to Recordings > Create data source.
-
Select Create a new table in the Create data source from recording window.
-
Name the data table.
-
Select the keys to add to the data table from the key/value list, then click OK. The new data table file source is added to the Project tree in the Data Sources folder.
Import a Data Table
-
Right-click the Data Sources folder in the Project tree and select New data source.
-
Select Import data table file and click Next to add an existing file to the project.
-
Navigate to the file you want to import using the Import Data Table dialog window and click Open. The new data table file source is added to the Project tree under the Data Sources folder.
Editing a Data Table File Source
To edit an existing data table file source, right-click the data table in the Project tree and select Edit. The data table opens in the configured external text editor. The data table file source information is also displayed in the Data Source view, which shows a preview of the data. You can open the data table file source with the external editor from this view.
Shuffling a Data Table File Source
Although the rows in a data table can be accessed randomly during script replay, it can be more convenient to access the rows in order from a file source that has been randomized prior to test execution. The Shuffle function can be used to shuffle the rows in a data table file.
To shuffle data table rows, right-click the data table in the Project tree and select Shuffle.
The first row in a data table is always assumed to be the header row, so it remains in place as row number one. All other rows, including commented lines, are shuffled.
Restoring a Shuffled Data Table File Source
After shuffling a data table, you might want to restore it to its original order. To restore a shuffled data table, right-click the data table in the Project tree and select Restore original.
Deleting a Data Table File Source
To delete an existing data table file source, right-click the data table in the Project tree and select Delete. Eggplant Performance asks you if you want to remove the corresponding data bindings from the tests. If you click Yes, the data bindings are removed from the test, the data table is removed from the Project tree, and the underlying file is deleted from the disk.
This action deletes the file.
Removing a Data Table File Source from a Project
To remove an existing data table file source from a project, right-click the data table in the Project tree and select Remove from project. Eggplant Performance asks you if you want to remove the corresponding data bindings from the tests. If you click Yes, the data bindings are removed from the test, the data table is removed from the Project tree, but the underlying file remains on the disk.
This action leaves the file in the project folder.