Description

The ExcelToMapGen Generator reads data from one or more columns within a specified Excel file and saves it to memory. Once the data is in memory, the ExcelFromMapGen Generator is used to get the data from a particular column by Column Name for each Attribute. 


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


ExcelToMapGen Parameters

The following parameters may be configured for the ExcelToMapGen Generator. Items with an asterisk* are required.

  • path* - Defines the path where the Excel file is located. 
  • subDir - Defines an optional subdirectory under the resourcePath where the Excel file exists.
  • fileName* - Defines the name of the Excel file located on the user's system. 
  • sheetName - Defines the sheet name in the Excel file. 
  • columnNames - Defines the list of columns to read the data from.
  • bufferSize* - Defines how many rows to keep in memory from the Excel file to avoid the "out of memory" exception. 
  • setLoop* - Provides the ability to OVERRIDE the loop count at the Scenario level and ONLY produce the number of rows defined in this list. This does not apply to GenRocket Express, as it does not use Scenarios. 
  • list - Stores one value on each line in the list. To enter values, type them in and hit ENTER. Note that the listed value shown is only for simulation mode. When running an actual Scenario, the data will be loaded from the specified resource.


ExcelFromMapGen Parameters

The following parameters may be configured for the ExcelFromMapGen Generator. Items with an asterisk* are required.

  • columnName* - The name of the column within the Excel file that data was read from. 
  • list - Stores one value on each line in the list. To enter values, type them in and hit ENTER. Note that the listed value shown is only for simulation mode. When running an actual Scenario, the data will be loaded from the specified resource. 



Preview Showing Empty Values - List Parameter

The ExcelToMapGen Generator reads the column data from the given Excel file and saves the values to memory. The ExcelFromMapGen Generator then obtains that column data. Both actions are performed while running the Scenario on the user's system locally. 


The list parameter can be used to simulate data displayed in the Preview pane for one or both Generators 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

A tester wants to populate values from an Excel file to different AttribDomain Attributes ExcelToMapGen and ExcelFromMapGen.

They need to query the Product, Price, and Qty columns within the Excel spreadsheet below and then populate the data for other Attributes. 



Project Setup

The tester has created a Product Domain that contains five Attributes: id, productDetails, product, price, and qty. The Excel file will be read and saved into a memory map for the productDetails Attribute. 



The Product Domain loopCount has been set to '6', meaning that the three data rows will be used twice for the output. 



Note: The productDetails Attribute is not visible because it will only be used to store the data in memory and is not needed for the output. 



ExcelToMapGen Configuration

For the productDetails Attribute, the tester has added the ExcelToMapGen Generator and modified the following parameters: 

  • fileName - Entered Excel file name (e.g., ExcelSample.xlsx).
  • sheetName - Entered sheet name (e.g., Sheet1)
  • columnNames - Entered three lines (Product, Price, Qty).
  • bufferSize - Entered the value 3 because three rows of data are in the sample file.
     


Note: Make certain the entered column names match the column names in the Excel file sheet. 


ExcelFromMapGen Configuration

The ExcelFromMapGen Generator has been assigned to three Attributes: product, price, and qty. Make sure the column name matches what is in the Excel file and what was entered for the ExcelToMapGen Generator. 


product


price


qty


Sample Output

The output below is in delimited file format.