How to Generate Email Addresses with Values From Your Own Seedlist
This is our fourth and final blog post in the series about generating email addresses with BlazeData. Here’s what we covered so far:
1. How to Generate Parameterized Email Addresses for Your Test Runs with BlazeData - explains how to reference parameters inside other parameters to create email addresses.
2. How to Generate A Unique Email Address for Your Test Run with BlazeData - explains how to assure your email address will always be unique.
3. How to Generate Email Address Separators with BlazeData - explains how to add email separators.
This time, we’ll cover how to create your own seedlist. This is helpful when you want to use values from your own list.
Let’s start with this data model:
Index - sequenceGenerator()
Firstname - valueFromSeedlist("firstnames", $Index)
Lastname - valueFromSeedlist("lastnames", $Index)
Domain - "acme.com"
Separator - valueFromList($Index, [".", "_", "-", "+"])
Email - ($Firstname + $Separator + $Lastname + "@" + $Domain).replace(/ /g, $Separator)
Let’s see how we can replace a Firstname with value from our list. In order to provide BlazeData with your list of values, you have to create a CSV file where each value is in its own row. For the sake of this example, you can use the ‘Download Generated CSV’ action in our Test Data panel.
Once you have your CSV ready, import it to the test data panel using the ‘Import CSV File’ action under the ‘+’ button.
Your CSV file will appear in the Test Data panel. Now you are ready to use it instead of predefined seedlists. To do this, we will use the ‘valueFromCSV’ function. Our Firstname attribute will change to this:
Firstname - valueFromCSV("my-seedlist.csv", 8, $Index)
The first attribute of the function is the name of your CSV file, the second is the column that should be used and last one is the row you want to get from your list.
In case you would like to get random values, you can change it to something like this:
Firstname - valueFromCSV("my-seedlist.csv", 8, randInt(1, 300))
This will take the first 300 values from your list and return them in random order. If you have less than 300 values it will loop through the existing ones. Feel free to increase this number in case you have more values in your CSV.
That’s it! You now have everything you need to get started with Test Data email address generation. To get started with BlazeMeter, sign up for free here.