Using Dynamic Data

Document created by Chris Sommerstad Employee on Jul 22, 2017Last modified by B-F-F08DRX on Sep 26, 2017
Version 3Show Document
  • View in full screen mode

SOASTA CloudTest provides a variety of methods for using dynamic data in tests.You can create dynamic users, passwords, and key word searches. For example, you can increment users in a test in a variety of ways. Dynamic data methods include:


  1. Track Counter

Using a track counter, you can set a system property ($systemprop) that increments and calls a track number for insertion.





In the screenshot to the right, the sysprop is a "Track property". Each property is substituted into a test clip in the same way, but with a unique or incremented value.

Note: the VUNumber starts at 0, not 1. The Track must have Virtual Users check box selected to exist (this checkbox is on the Properties for a Track in the Composition).


  1. Array File

Using an array file from a script (using JavaScript), you can insert values into a test. This method works well for random users.

Your script should include the following:

  • Seed data array. Place the array inside the Javascript itself.
  • Data Selection from that array
  • And a property setting using the data from the array


  1. First, you build the array of desired data.


The array will be declared in the script file and will look like this:

var oStrings = ["Value1","Value2"];

Arrays require a special format. On the right, an example of declaring a variable named oStringsand setting its value to an array.

  • The data for any array starts with '[' and ends with ']'
  • Terminating any JavaScript line uses the semicolon ';'
  • The values inside the array should be wrapped in double quotes
  • At the end of a value, you have a comma before the next value
 var oStrings = [ "PG3032901074056", "PG3052321074056", "PG3062641074056", "PG3082651074056", "PG3182821075056", ]; 


  1. Next, you have to have code that 'selects' or 'chooses' a value from the Array. This extraction will also set the value extracted into another variable.

Here 0 is the index for which value we are pulling from the array. This index can be specified or obtained randomly. Arrays use numerical indexes. Usually starting with 0. You can get a value from the array with this syntax: oStrings[0]

This gets the 0th index from the array. When you pull from the array, you have to specify the index you want from it.

Note: If you choose an index that does not exist, you will get an "Index Out of bounds" error.

var getValueFromArray = oStrings[0];

An example of random extraction:

var a = oStrings[Math.floor(oStrings.length * (Math.random()))];

  1. Once you have chosen the value from the Array, take that selected value into a property that the clip can use.

In the example on the right:

  • MessageClip is the scope of the property, or where it lives.
  • NameOfPropertyInClip is the name we will use in the Clip to pass this value.
  • getValueFromArray is the JavaScript variable name that we used to store the value we extracted from the Array


$prop.set("MessageClip", "NameOfPropertyInClip", getValueFromArray);

There are two ways to set properties in SOASTA CloudTest:

  • Seed data such as from an index from an Array or terms to use in a Search
  • Extracted Values. Example: After logging into a site, we need to extract data and put that data into a property in order to pass it to all the Messages that come after. For example, a SessionID. See Extract a sessionID for more information about extracted values such as sessionID(s).

In the example on the right, we are setting a clip property with the name of scriptSessionId to the value of the variable in the JavaScript from the array extraction.

$prop.set("MessageClip", "scriptSessionId", scriptSessionId);

  1. Seed Data (from a flat file)

Seed data can be extracted from a URL file or resource and then accessed within the test.

Note: The values are not guaranteed to be used in order and contiguously. There can be “gaps” in the values selected from the given resource. Each Track gets a unique value.

    1. Put a list of data values into a resource file.
      • To use this new feature, you need to put a flat file with a list of data (one item per line) in a location accessible to the SOASTA CloudTest Maestro server as a URL.
      • This is not a CSV parser and only handles a single list—no arrays.
      1. Setup track properties
      • The Track Properties method works by assigning a single value from the file to a specific track. This is most useful for usernames. Each track (i.e. virtual user) will get its own username—and it is guaranteed that across the composition no other track gets that item from the file.
      • The track property needs to identify the file.

  1. Setup clip to use a track property
  • Instead of using clip properties to access the data, use track properties using this syntax in your clips: 

    {%% prop : track : seedDataAccountName %%}

  1. Additional Considerations for data file creation and use in compositions
  • Always have a data file that is larger than the number of entries you will have.  The amount of excess you need will depend on (1) the number of users/load generator and (2) the number of load generators.
  • When a composition is run, the data file is loaded onto the alpha load generator, cut into chunks, and distributed to all the servers.  This is chunked evenly.  Here’s how the math works:
    • The test is for 10,000 users and will run with 500 users/load generator.  This means 20 load generators are required (10,000/500). 
    • The data file has 11,000 entries in it.  This means each of the 20 load generators will get 550 entries from the file (11,000/20).
    • You want to make sure the number of entries in the file (in this case, 550) exceeds the number of users/load generator (in this case, 500).  If not, you need more entries in the seed file.


  1. Web Service Call to a Database

SOASTA CloudTest provides both SOAP and REST methods to call a database using whatever API is provided. In the following example, we will use a SOAP service to get name from a MySQL database.


    1. Create a SOAP web service that extracts data from a database.
    2. Identify the URL to the SOAP service’s WSDL file.

This example uses MySQL as the source database. For example, a WSDL that extracts data from MySQL.


  1. Create a SOASTA SOAP target pointing at this new SOAP web service. See Create a New Target in Target for instructions.

For example:



    1. Create a SOASTA test clip that uses this new target. See Creating a New Clip for instructions.

The example test clip will query data from a MySQL database using select statements in the executeQuery operation of the newly created target.

  1. With the new test clip open, double-click the MySQL target (in the lower-left pane of the Clip Editor) to add it to the “Included Targets” list.

    1. Double-click the executeQuery operation (in the lower-right pane of the Clip Editor) to add an empty SOAP message to the test clip.

  1. Double-click Message 1 to open its properties in the lower panel.

  1. Edit the Input. , the SQL being run will be:

    select FirstName, LastName from Contacts where id='1'

In this sample, we are extracting one record at a time.

  1. Click Play in the Message Editor panel. The single SOAP request is sent to the destination server.



    1. The XML request sent is shown in the lower-left pane of the test clip editor and the results of the query will be shown in the lower-right pane of the test clip editor. The data returned by this query can now be used in subsequent steps in the test.


  1. Click in a field with the data you want to use (the field with “Aaron” is selected in the image to the right).

Click the Properties icon on the right to access the Property Chooser dialog box.

  1. Assign the data that comes back in this query to the selected Property. In this case, a global property named “Contact Data/First Name” has been selected as the property to store this data.
  2. Repeat this process for each data element you want stored in a property. When you want to use this property in a test message, you use it like any other property. In an input field, simply click the white properties icon, select the property you want included in your input, and then click OK.

Note: As usual, run your tests in a test composition for full playback of your test suite.

    1. Global Properties

SOASTA CloudTest provides global properties that can be used to increment users. This method is effective for SOASTA CloudTest appliance users but has limits that apply to larger tests.