Data Generator

abstract We can create unique data for repeated execution using Data Generators.
goal Make a test repeatable by generating unique data every time.
If we run the user registration path we just created, we will find that it fails. It fails because the email id has already been registered (when we recorded it).

For the path to run again and again, we need to generate a new email id every time.

info Automation Tip: Applications need an email id in registration forms so that registration confirmation information, password reset etc. can be sent to the user.
You need access to the email inbox to test those features. So the email id needs to be real. However, automation requires that you need to register multiple times.
It may not be possible to generate a new email id for each registration. So how do we solve this?

We can use email subaddressing. Many email providers allow adding extra information by adding a +.
Eg., mahi@example.com and mahi+yellow7@example.com both will be delivered to mahi@example.com

We can utilize this in automation by adding a timestamp after the + to generate unique email ids. Eg. mahi+17134925239561@example.com
Most applications allow the + during registration, and consider these emails to be unique.

If your application does not allow this, consider allowing it during testing and turn it off in production.

You can read about email subaddressing here:

https://en.wikipedia.org/wiki/Email_address#Sub-addressing
https://datatracker.ietf.org/doc/html/rfc5233
steps

Email Data Generator

Let us add a data generator for the user's email field.
  1. Click on any node of the flowchart > click on Automate > Go to Entities tab.
  2. Select $user entity on the left pane.
  3. Select email attribute on the left pane.
  4. Select the sub tab Data Generator
    Notice that Flowcharts has detected the value as an email and separated it into meaningful tokens like name, domain etc.
    You can add more names and domains to generate more emails.
  5. Of particular interest for us is the add-timestamp field. Let us set it to true.
    This will add a timestamp to the email and make it unique for each run.
  6. Check the sample values by using the Refresh Preview button .
  7. Click on Save Entity.

Text Data Generator

Similarly, let us add a Text Data Generator to the user's firstname.
  1. Select the attribute name: firstname
  2. Set the parameters as shown here :
  3. Check the sample values by using the Refresh Preview button .
  4. Click on Save Entity button.

Other Data Generators

info There are various types of Data Generators. We can choose the Data Generator type which best suits the attribute. Each Data Generator type has its own parameters.
outcome By associating Data Generators, we generate unique data for each run, so that tests can run repeatedly.
concepts
  • Entity
  • Attribute
  • Data Generator
  • Quick Extract