Using Test Data in Taurus Performance Tests

Same as other script types, Taurus scripts can load test data from external CSV files and from BlazeMeter Data Entities.

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:

You can use one or combine multiple data sources in a Taurus test, as needed. For more information about BlazeMeter's test data integration in general, see What are Data Entities and Data Parameters? and How to Use Test Data.

Example Scenario

This article assumes a scenario where you already have a Taurus Performance test in YAML format. The Performance test sends requests to the online store endpoint at http://blazedemo.com/buy/123-phone. You want to use more varied test data in place of the product id "123" and the product name "phone". To do this, you have the option to load existing data from a CSV file or let BlazeMeter generate synthetic test data.

Prepare your test data

  1. Create a Performance test.

  2. Upload the Taurus script with hard-coded test data. For example:
    TaurusPerformanceTest.yaml

    execution:
    - concurrency: 100
      ramp-up: 1m
      hold-for: 1m30s
      scenario: simple
    
    scenarios:
      simple:
        think-time: 0.75
        requests:
        - http://blazedemo.com/buy/123-phone  # hard-coded test data "123-phone"
  3. Open the Test Data pane.

  4. Create Test Data Entities using one or more of the following methods:

    • Upload a CSV file and attach it to the test.
      Example: Upload "MyTestDataFile.csv" which contains the columns id and name.

    • Create a Data Entity for the test.
      Example: Create "MyDataEntity1" that contains synthetic test data which contains the Data Parameters randomid and randomname.

    • Load a shared Data Entity from the BlazeMeter Workspace.
      Example: Load "myshareddata.csv" from "MyTeamFolder" which contains the columns username and password.

  5. Identify the Data Parameter names that you want to use in the test.
    Examples:

    • To use values from the CSV column id, reference ${id}.

    • To use values from the CSV column name, reference ${name}

    • To use the synthetic randomid, reference ${randomid}.

    • To use the synthetic randomname, reference ${randomname}

    • To use the shared username, reference ${username}.

    • To use the shared password, reference ${password}

  6. And so on.

 

Prepare the Taurus test

Adding the data-sources section to the Taurus script is optional when a Data Entity is associated with the test in BlazeMeter. When a test is executed, BlazeMeter dynamically adds any Data Entities associated with the test, using default Data Settings.

  1. Edit the Taurus Test in the Test Configuration.

  2. Parameterize the request by replacing the hard-coded values.
    For example, replace "123" and "phone" by ${id} and ${name}.
    http://blazedemo.com/buy/${id}-${name}
  3. (Optional) To override the default Data Settings, define your Data Entities in the data-sources section of the Taurus file.

    Use the following options:

    • path
      Defines the path to an attached CSV file or Data Entity. To identify the implicit file name of the Data Entity, click the info button next to its name.
      Example: Reference the Data Entity MyDataEntity1 as MyDataEntity1.csv.
      identify the path to a data entity as csv file
    • delimiter
      Defines the CSV delimiter.
      Default: Auto detect
      Values: '.' for dot, ',' for comma, 'tab' for a tab symbol.
    • quoted
      Interprets the CSV columns as quoted data. Can be true of false.
      Default: auto detect
    • encoding
      Defines the encoding type.
      Example: "utf-8"
    • loop
      Defines the behavior when BlazeMeter reaches the end of the test data: If set to true, we loop over and continue again from the beginning of the test data. If set to false, we stop looping.
    • variable-names
      Defines the comma-separated list of Data Parameter names for the CSV columns. If the first row of the CSV file already 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.
      Default: The first line of the CSV file is used as Data Parameter names.
      Example: variable-names: id,name

For more information about the options, see https://gettaurus.org/docs/DataSources/.

 

The Taurus script now looks like the following example:

TaurusPerformanceTest.yaml:

execution:
- concurrency: 100
  ramp-up: 1m
  hold-for: 1m30s
  scenario: simple

scenarios:
  simple:
    think-time: 0.75
    requests:
    - http://blazedemo.com/buy/${id}-${name}  # use Data Parameters in test

    # list your Data Entities
    data-sources:
    - path: MyTestDataFile.csv            # load Data Parameter values from a CSV file
      delimiter: ','
      quoted: false
      encoding: "utf-8"
      loop: true
      variable-names: id,name             # define Data Parameter names for columns

To override the default Data Settings of other data sources, such as shared files from the BlazeMeter Workspace or synthetic data from a Data Entity, add more paths and settings. For example:

    - path: MyTeamFolder/myshareddata.csv # load shared Data Entity from the Workspace...
      variable-names: username,,password  # skip the second column, rename the first and third
 
    - path: MyDataEntity1.csv             # load Data Parameter values from a Data Entity...
      loop: false                         # don't loop this data

 

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.

  1. Open a Performance Test with test data attached.
  2. Verify that at least one data parameter is defined to be able to generate the data preview.
  3. Click Test Data, Data Settings.
    The Test Data Settings window opens and shows the data preview.

 

Related Tasks