The MapCSVGen Generator loads its list from column data within a CSV file.
In This Article
The following parameters may be configured for the MapCSVGen Generator. Items with an asterisk* are required.
- filePath* - Defines the path where the CSV file is located.
- fileSubDir - Defines an optional subdirectory under the directory where the CSV file is located.
- fileName* - Defines the name of the CSV file to open.
- keyColumn* - Defines which column in the CSV to read the key from.
- valueColumn* - Defines which column in the CSV to read the value from.
- delimiter* - Defines what delimiter is used to separate column data within the CSV file.
- keyReference - Defines the reference that you want to be used as the key value in the data map.
- valueReference - Defines the value reference that you want to be used to get the key for that value.
- list - Stores one value on each line in the list. These values only simulate data in the preview and are not used when generating data.
Preview Showing Empty Values - List Parameter
The MapCSVGen generator reads the data from the given CSV file and loads the data while running the Scenario on the user's system locally.
The list parameter can be used to simulate data displayed in the Preview pane on the GenRocket web app.
If no values are entered for the list parameter, the preview will show Empty values for each record.
When users add values to the list parameter, this data is simulated for preview only. The added values will appear in the Preview pane.
Use Case Example
For this use case, the tester wants to read values from a CSV file using a specific key reference defined within the 'No' column of the CSV file titled ProductList.csv (displayed below).
The tester wants to query the value from the Price column and populate that value in a price Attribute.
In the price attribute, two Generators need to be linked together:
- RangeGen Generator - Determines the key of the data that we’d like to query.
- MapCSVGen Generator - Determines where to read data from within the CSV file.
Generates a number range of 1-3 that will be referenced by the keyReference parameter within the MapCSVGen Generator.
Reads the 'No' column as the keyColumn and the ‘Price’ column as the valueColumn.
The keyReference should be the key from the ProductList.csv that we want to query. It references the RangeGen Generator, which generates a number 1-3. Using the keyReference, we can get the values of Price.