Description
A Domain may be created from a CSV (Comma-Separated Value) file by performing a CSV Import. This method can be used to create a single Domain. Each field or column within the file will be an Attribute. The assigned Generator will depend on the Generator Type option selected during the import.
Important: CSV files cannot be greater than 2 MB in size.
In This Article
CSV File Format
CSV files are plain text files in which a delimiter separates values, such as commas or tabs. They can contain the following:
- Header Row (Optional) – Contains column names for data fields.
- Data Rows – Each subsequent row represents a record, with values separated by commas (
,
) or another delimiter (such as;
or|
in some cases). - Fields (Columns) – Each row contains multiple fields corresponding to the column headers.
- Line Breaks – Rows can be separated by a newline character, such as \n or \r\n.
- Text Formatting – Text fields can be enclosed in double quotes ("...").
Sample CSV File
In the comma-separated example below, the created Domain will have three Attributes: id, firstName, lastName, middleInitial, username, and password.
How to Import a CSV as a Domain
- In the Projects Dashboard, select a Project and Project Version.
- Expand the New Domain menu in the Domains pane and select Import from CSV.
Step 1 - Create the New Domain
- Enter a Name for your new Domain.
- Specify the delimiter in the CSV file (Commas, Tabs, Semicolon, etc.). For this example, Comma has been chosen.
- Browse to and upload your CSV file.
- Click Save once finished.
Step 2 - Specify Generator Type
When uploading a CSV file as a Domain, you have three options for the Generator type (Static, Dynamic, and Synthetically Generated).
- Dynamic Data from CSV - More than 15 records in the CSV file.
- Static Data from CSV - 15 records or less in the CSV file.
- Synthetically Generated - Values are synthetically generated by GenRocket Generators.
- Static Data from CSV - Assigns a ListGen to each of your Attributes. Each ListGen will have a list populated from the corresponding column in your CSV file. You can only choose this option if your CSV file has less than 16 rows of data. To try this method, you can use the staticUser.csv file attached to this article to create a Domain.
- Dynamic Data from CSV - References a CSV file on your local machine. When you run your GenRocket Scenario, the GenRocket Runtime will pull data directly from your CSV file to generate your specified data. This will require you to specify the CSV file name and path so the GenRocket Runtime knows where to pull the data.
You can input your file path and name as a hardcoded string or an Organization Resource. We recommend using an Organization Resource to make sharing Scenarios easier. To try this method, you can use the attached dynamicUser.csv file at the end of this article.
Hardcoded String
Organization Resource
The resource is shown below: - Synthetically Generated: A Generator will be assigned automatically to each Attribute within the created Domain. Once the Domain is created, you can preview the synthetic data for each Domain Attribute and make any needed Generator or Generator Parameter configuration changes.
Step 3 - Specify Attributes to Generate Data For
Click the checkbox for each of the Attributes for which you want to generate data. You can select the checkbox at the top to select all the Attributes. Click Save when you are done selecting your Attributes.
Import Option Results
Static Import
When you look at your imported Domain's Attributes, each has a ListGen assigned to it. The data in the list area is pulled directly from your CSV file.
Dynamic Import
When you look at your imported Domain's Attributes, you will see that each has a ListCSVGen assigned to it. In the list area, you will see up to 15 rows of example data being shown to give you a sense of what your generated data will look like. When your Scenario runs on your local machine, the GenRocket engine will look at the CSV file itself to generate the data.