JMeter scripts can load test data from external CSV files and from BlazeMeter Data Entities. If you have a different script, see also Example Scenario .
Tip: The Test Data pane is visible only after you have uploaded or recorded a test script.
As with all test types, BlazeMeter supports the following data sources to provide test data to a Performance test:
- How to Load Test Data from Spreadsheets.
- How to Generate Synthetic Test Data.
- Find Test Data (TDM Find & Reserve Model Integration)
You can use one or combine multiple of these data sources in a test, as needed.
How Do I Reference CSV Files?
Edit your BlazeMeter script and reference your CSV files using relative paths, as described in this article. You can upload existing CSV files or create Data Entities in BlazeMeter: When you create a Data Entity, BlazeMeter creates a corresponding CSV file that you can reference from your script.
Data Source | Relative Path |
A Data Entity created in BlazeMeter named "My test data" | "My_test_data.csv" |
A CSV file my_test_data.csv uploaded to BlazeMeter and attached to a test | "my_test_data.csv" |
A CSV file our_test_data.csv uploaded to BlazeMeter's Shared Folder our_shared_folder | "our_shared_folder/our_test_data.csv" |
Tip: To identify the implicit file name of the Data Entity, click the info button next to the Data Entity's name. The implicit data file names and their contents are also included in the report log.
Use test data in Performance Tests
You can start by adding a Data Entity in BlazeMeter, and later edit the JMeter file to use it. Or you can upload existing JMX and CSV files together, and expand the data entity in BlazeMeter later. Or you can record a JMeter test using the Chrome Recorder Extension, and add data entities and CSV files later.
- Go to the BlazeMeter Performance tab.
- Open a Performance Test.
- Click Test Data and click the Ellipsis button to add a data entity.
- Click the small plus button to add one or more data parameters to the data entity. For more information in data parameters, see How to Use Test Data.
- Download the data entity as a CSV file.
Prepare the Test Configuration File
BlazeMeter uses the first row of data as parameter names to refer to columns in the CSV file. If the first row does not contain column names, provide a comma-separated list of variable names in the test configuration file. Open the JMX script in JMeter and edit the following fields in the "CSV Data Set Configuration".
- File Name:
Provide the relative file path of the file attached in BlazeMeter.
Example:
File Name: My_test_data.csv - Variable names:
If the first row contains column headings, leave this option empty. If the first row contains data, define column name mappings here. To skip a column in the mapping, add an extra comma with no name.
Example:
Variable names: lastname,firstname,,street,number,,
Example:
The file "mydata.csv" has six columns and no column headings. You want to reference address data in column 1, 2, 4, and 5, and ignore column 3 and 6. Therefor you declare the following variable names:
lastname,firstname,,street,number,,
In a test script, you will be able to reference the values of column 1 as ${lastname}, column 2 as ${firstname}, column 4 as ${street}, and so on.
For more information about the test configuration file, see Using CSV DATA SET CONFIG and CSV file upload.
Upload the Test Script to BlazeMeter
- Log on to BlazeMeter and go to the Performance tab.
- Upload the prepared JMeter file.
- Click Test Data to open the Test Data pane.
- If the script has unresolved references and variable names in its "CSV Data Set Config", BlazeMeter lists the missing files.
Choose from the following options:- Click Upload CSV File to attach the missing files.
- Click Suggest Data to automatically generate synthetic test data for the defined variable names.
- Click Load Data Entity to load existing shared test data from the workspace.
- Make sure to create and define all parameters that are referenced in your script.
Preview Test Data
Previewing your test data is helpful when you are combining data from multiple files, or generating synthetic test data, so you can review values in context.
- Open a Performance Test with test data attached.
- Verify that at least one data parameter is defined to be able to generate the data preview.
- Click Test Data, Data Settings.
The Test Data Settings window opens and shows the data preview.
0 Comments