How to Generate Email Address Separators with BlazeData
BlazeData enables you to generate parameterized email addresses for our test runs. In our previous blog posts, we learned how to generate email addresses and unique email addresses. In this post, we will discuss email separators.
Index - sequenceGenerator()
Firstname - valueFromSeedlist("firstnames", $Index)
Lastname - valueFromSeedlist("lastnames", $Index)
Domain - "acme.com"
Email - ($Firstname + "."+ $Lastname + "@" + $Domain).replace(/ /g, ".")
As you can see, we are using "." as a separator between firstname and lastname. In this blog, I would like to show you how you can play around with this separator and run different separators in each test iteration. In order to do this, we need to extract our separator from the email value and turn it into a standalone parameter.
Separator - "."
Email - ($Firstname + $Separator + $Lastname + "@" + $Domain).replace(/ /g, $Separator)
After this step, our example will still work the same way as before.
Now, let’s change the Separator value using randFromList function.
Separator - randFromList([".", "_", "-", "+"], 0)
The randFromList function returns a random value from a predefined list. The second parameter defines the percentage of a null value. This is not very helpful for our needs, so we will set it to 0. Now we will have email values with separators used in an undefined order.
Another option is to loop through the separator values using the valueFromList function and our Index parameter. This will assure that all our separator functions will be used with the same number of occurrences (more or less). Our Separator parameter will look like this:
Separator - valueFromList($Index, [".", "_", "-", "+"])
Tip: The valueFromList will loop from the the beginning once the Index reaches its end.
To get started with BlazeMeter, sign up for free here.