The MapExcelChildGen Generator reads data from Excel Spreadsheet, creates Map again on every Child Domain iteration, and returns the matched value from the column provided in valueColumn parameter.
Note: Reading data from an Excel File (using ListExcelGen or another Excel Generator) is slower than reading data from a plain delimited file (ListCSV or CSVToMap, etc.).
In This Article
- Generator Parameters
- Preview Showing Empty Values - List Parameter
- Use Case Example
- filePath* - Defines the path where the Excel file is located.
- fileSubDir - Defines the subdirectory within the file path where the Excel file will be located.
- fileName* - Define the name of the Excel file to open.
- sheetName* - Defines the sheet name in the Excel file.
- keyColumn* - Defines which column in the Excel file to read the key from.
- valueColumn* - Defines which column in the Excel file to read the value from.
- keyReference* - Defines the reference that you want to be used as the key value in this data map.
- setLoop* - Defines whether the size of the list of children should be used to set the Domain loop value.
- list - Stores one value on each line in the list. To add values, type them in and hit ENTER. Note that the listed value shown is only for simulation mode; when running a true Scenario, the data will be loaded from the specified resource.
- defaultValue* - Defines the default value if there is no value matched with the Key.
Use Case Example
A tester wants to retrieve a column from an Excel file using the key from a parent Domain within a Project. For this example, two Domains have been created with a Project: OrderParent and Order.
The id Attribute within the OrderParent Domain will be used as the key for the Order Scenario Domain, which contains a product Attribute for the actual value.
The required Generator configuration will be completed at the Scenario Level for the Order Scenario Domain, and the Excel file is shown below:
OrderParent Scenario Domain
It contains an id Attribute, which is used as the key for another Domain that will query from the Excel file. For this example, the Domain is created with the default id Attribute.
Order Scenario Domain
It contains a product Attribute that uses the MapExcelChildGen Generator to reference the parent Domain (OrderParent) in the keyReference parameter to determine what data will be retrieved from the Excel file.
The MapExcelChildGen Generator has been assigned to the productAttribute within the Order Scenario Domain. The keyReference parameter references the id Attribute within the Order Scenario Domain.
Based on the keyReference, we are referring to the ‘No’ column as the key to get the value of ‘Product’ from the Excel file.
The expected output will appear as shown below in delimited file format. The product column values within the Excel file have been queried using the keyReference for the parent Domain.
The Excel file for comparison: