Marta is a Client Services Consultant at Broadcom, specializing in Continuous Testing, DevOps and Automation.  She has over 18 years experience in helping teams develop and deliver software more efficiently.  

Become a JMeter and Continuous Testing Pro

Start Learning
Slack

Test Your Website Performance NOW! |

arrowPlease enter a URL with http(s)
Apr 12 2021

Using Seed Lists to Generate Realistic Data for Functional Testing in BlazeMeter

Getting test data for application testing is a perennial challenge. Data that is too simple doesn’t provide proper real-world interactions with the application that customers would normally use. Privacy laws and regulations make production data inaccessible for use in testing without masking or obfuscating data. The need for appropriate production quality test data is very real.

 

BlazeMeter has recently introduced BlazeData, which allows testers to generate production quality synthetic data to use in GUI functional testing. This data is generated via different functions available to the tester. Parameters are then used to store the data values created with functions, and used in the test steps.

 

BlazeMeter provides functions to generate strings, characters, dates, and numbers to name a few. There are also functions to get values from seed lists. Let’s look at what seed lists are and how to use them to optimize your testing.

 

What are Seed Lists?

Seed lists are realistic datasets created following specific data criteria. These datasets are available out of the box, or maybe out of the cloud (since it’s SAAS) and available for use in BlazeMeter tests. The seed lists include data such as names, emails, addresses, valid credit card numbers, days of the week, and ip addresses. Testing requires using real data and testers may need test data that is restricted to specific subsets, for example, a specific set of users or a specific geographic location. It is very time consuming to generate these specialized datasets by hand.

 

BlazeMeter has over 50 seed lists such as German First Names, Indian Last Names, email addresses, American addresses, Australian Postal Codes, UK Counties, and Companies to name a few.

 

Seed lists can either have a single column or be multi-columned, according to the data they provide. Single columned seed lists have only 1 entry per line and can be easily referenced in the functions using just the seed list name. For example, the female names seed list has a single column with each row containing a female name such as Anna, Marta, Kathy, or Susan. In contrast, the icd10-multicol seed list is composed of medical diagnostic codes. The seed list has 2 columns, the ICD-10 code, and a human-readable name for the code and can be accessed by one of the functions described below.

 

Addresses are another good example of multi-column seed lists. A US address needs a Street Number, Street Name, City, State and Zip Code to be valid. The US Multi column address seed list might look like the table below. The columns map to the data fields and each row has contextual data for all of the fields.

 

Col 1 (Address) Col 2 (City) Col 3 (State) Col 4 (Zip)
123 Cherry Lane San Francisco CA 94123
99 Apple Street Phoenix AZ 85022

 

Typically, if a seed list is multi-columned it will be indicated in the seed list name.

 

The rows in multi-columned seed lists need to be consistent across each data field or column. We would expect an address with the city of Beverly Hills to have California as the state and also have an appropriate zip code like 90210. 

 

Therefore, creating data parameters with consistent data is necessary. In order to get consistent data, it is important to properly reference both the data row and the data column in the appropriate function in your test. Let’s see how to do it, with three different BlazeMeter functions.

 

How To Use the Seed Lists

There are 3 functions that expose Seed list values in BlazeMeter: randFromSeedlist(), valueFromSeedlist() and randlov(). It’s important to understand how to use them, to ensure we get consistent test data in multi-column seed lists.

 

1. randFromSeedList()

This function returns a value from a random row in the seed list provided. In its simplest form, add the seed list name in quotes as an argument to the function. For example, randFromSeedlist(“femalenames”) returns Susan in the preview in the example below.

The function can also take additional arguments for testing different scenarios. For example, it can take a column number reference and a numeric value that represents the percentage of null values to return.

 

The signature for this function looks like this:

randFromSeedlist(seedListName: string, column: number = 1, percnull: number = 0) and an example would be randFromSeedlist("usaddress-multicol", 1, 20). This returns data from the first column (street name) of the US Address multi column seed list 80% of the time and 20% of the time will return a Null value. For example, it may return "325 Beacon St" or null. Using null values in functional tests provides a great way to test how the application handles invalid data as well as valid data.

 

The following screenshots show an example of the Bank Account Number (bankaccountno) seed list. This returns a random 8 digit United Kingdom bank account number. It is possible to preview the data by clicking the eye icon in the test data panel.

 

 

2. valueFromSeedlist()

This Function retrieves a value from a specific row location in the data set. This ability is especially useful for maintaining data that are consistent across multi column seed lists.

 

The signature for this function is valueFromSeedlist(seedListName: string, index: number, column: number = 1). It takes the seed list name, the index of the row of data, and the column number of the data field.

 

The row index starts at 1. There is no need to know the number of rows in the seed list. If the row value provided in the function is larger than the number of rows in the list, the function will use the modulus operator to return an appropriate value.

 

In the examples below, we are getting the value for row 4 column 1 and row 4 column 2 from the Australian postal code seed list.

 

The function valueFromSeedlist("australianpostalcodes-multicol", 4, 1) returns the postal code

and valueFromSeedlist("australianpostalcodes-multicol", 4, 2) returns the city.

 

Hard coding the row value works if you only have one data iteration for your test or if you don't care about data variability for these particular fields. However, if you want to test multiple data iterations it is best to create a parameter for your row data value. This parameter will choose random row numbers, while maintaining consistency across all address fields.

 

BlazeMeter functions can accept parameters or other functions as arguments. To generate a random number for your row index you can run something like this:

 

${usaddress}

valueFromSeedlist("usaddressbig-multicol", ${seq}, 2)

${city}

valueFromSeedlist("usaddressbig-multicol", ${seq}, 5)

${state}

valueFromSeedlist('usaddressbig-multicol', ${seq}, 4)

 

${seq}

randInt(1,100000)

 

Where the seq parameter is a random number between 1 and 100000, i.e the function will choose a number between 1 and 100000. The seq is used to ensure the same row of data gets used for each of the fields in the address seed list.

 

This number is generated afresh for each data iteration. So for each data iteration that is run for the test, there is a new seq value.

 

The iterations menu includes a data preview to see what the data may look like for the test. In the below screenshot there are eight defined rows. For each row there is a distinct seq param that provides the value for the multi column us address seed list.

 

It is possible to mix static and dynamic data within a single test. In the example below the AusCity and AusPostalCode fields remain the same for each data iteration whereas the US address fields change for each iteration.

 

As you can see, BlazeMeter supports a mix of static and dynamic data in one single test. This enables you to maintain consistency while still testing random values.

 

3. randlov()

Similar to randFromSeedList(), this function returns random values from a seed list. But it may also return random values from other data sources besides seed lists, for example, a perclist or a string array. The function signature is: randlov(percnull: number, source: seedlist | perclist | string[], column: number =1) Where percnull is the percentage of null values to return, the source is where to get the data from, and column represents the data field column. For single column seed lists this will be 1.

 

In the below example, we are asking for a random value from the “lastnameindian” seed list with 20% null values.

 

randlov(20, seedlist("lastnameindian"), 1)

 

More realistic data for higher quality test results

Seed lists provide production quality data that is easily accessible to tests in BlazeMeter. Using seed lists helps make your tests more robust and higher quality by providing consistent high quality data at execution time. Sign up for BlazeMeter to create your first GUI test with synthetically generated data! To view all of the seed lists available, visit our documentation page on seed lists and Test Data Generator Functions.

 

 

   
arrowPlease enter a URL with http(s)

Interested in writing for our Blog?Send us a pitch!