Skip to content
Swarmetry

Build scenarios

Fake data

Give every virtual user realistic names, e-mails, phones, birth dates and addresses: presets, generators and options, "only when" conditions, preview, the Fake data menu of fields, from a recording or Postman.

A sign-up test that sends the same e-mail a thousand times tests nothing: the site answers "this e-mail already exists" from the second user on. Fake data gives every virtual user realistic values of its own (names, e-mails, phone numbers, birth dates, addresses…), generated during the test, without writing code and without preparing a file.

Fake data is a kind of dataset: a set of columns, each filled by a generator (first name, e-mail, phone…) with its options. A field of a request or of a browser step reads a column as {{person.email}}, like any dataset column.

Add fake data

In the workflow editor, click an empty place of the canvas (or press Escape): the panel on the right shows the scenario. Its Datasets section lists the datasets; under Add fake data, choose a starting point:

Starting point Columns
Person gender, first and last name, e-mail, mobile phone and birth date
Address street, postcode, city and country
Company contact company, contact first and last name, e-mail and landline
Blank one column to start from

A set of fake data with its columns

The set gets a name (person, address…): it is the first part of its references. Then:

  • Language and style: the language of the names, streets and cities, and the way phone numbers and dates are written (20 languages and regions, such as English (United States), English (United Kingdom), French (France), German (Germany), Spanish (Spain), Portuguese (Brazil)). It starts with the language of the editor.
  • Country: the country of the phone numbers and addresses, when it differs from the language's (French names with Belgian phone numbers). 21 countries are supported.
  • New values: At each iteration (a new person every time the flow runs, the default) or Once per virtual user (each virtual user keeps its person for the whole test, for example to log in again with the account it created).
  • Same data at every run: each virtual user gets the same rows in every test (useful to compare two runs or to reproduce a problem). Without it, every test draws new values.

Columns and generators

Each column has a name (used in the references), a generator and the options of that generator. Choose a generator under New column, then Add the column; the cross removes a column.

Group Generators
Person Gender, First name, Last name, Full name, Title, Birth date, Age, Username, E-mail, Password
Contact Phone number
Address Street address, City, Postcode, Country
Company Company
Values Whole number, Decimal number, Yes or no, One of a list, Date, Pattern, Regular expression, Text, Unique identifier (UUID), Combine columns

The options adapt to the generator. Some examples:

  • Gender: the share of women (70%), of other genders, and the words written (F / M, Mme / M.).
  • First name, Title: any, female, male, or From the column gender: they then follow the gender of the row (the Person preset does it). A title in French is Mme or M., in English Mrs or Mr.
  • Birth date: between two ages (18 to 30) or between two dates, in the format the form expects (DD/MM/YYYY…).
  • E-mail and Username: built from the first and last name of the row (marie.dupont…) when they read the name columns (First name from column, Last name from column: the presets and the Fake data menu set it), on the domain you choose (example.com by default), unique in the whole test, cut to the maximum length of the field.
  • Password: length, upper case, lower case, digits and symbols, as the form requires.
  • Phone number: mobile or landline, written as the form expects: +33 6 12 34 56 78, 06 12 34 56 78, +33612345678 or digits only. The numbers are valid for the country (right prefixes and lengths).
  • One of a list: a value of your list, with weights (80, 20: four times out of five the first one).
  • Regular expression: any value matching the expression a field checks, such as [A-Z]{2}[0-9]{6}.
  • Combine columns: a text made of other columns, such as {lastName} {firstName} in capitals (MARTIN CLAIRE) or the company's name in lower case with dashes between the words.

Leave empty (%) sends an empty value in that share of the rows, like a person skipping an optional field.

Only when…

A column can use another generator for some rows: Only when chooses a column, a comparison and a value. For example a discount code column says NONE, and only when the age is less than 26 says YOUNG26; a newsletter column says no, and only when the country is FR says yes.

A column with a condition

Preview

The Preview at the bottom of the set shows the five rows the first virtual user gets, updated after each change. Refresh shows the rows of the next virtual user. A problem in the set (an option out of range, a condition on a missing column) is shown next to the field concerned and the preview waits until it is fixed.

The preview of the rows

Use the columns in your steps

  • Type {{ in a field: the suggestions list the columns of your sets (person.email).
  • Or open the { } menu (Insert a reference) of the value of a browser Fill step, a form field, a query parameter or a header, then Fake data: the first entry is the generator the field calls for (an e-mail field suggests E-mail, a prénom field First name), then every generator. Choosing one adds the column to your set (the set is created when there is none) and writes its reference. Choosing E-mail again for an "E-mail confirmation" field reuses the same column, so both fields send the same address.

The Fake data menu of a form field

Within one iteration, {{person.email}} is the same in every request. When the e-mail reads the name columns (as in the presets), it also matches {{person.firstName}} and {{person.lastName}}: the row is one person.

From a recording

When you review a recording (Record with the browser), the pipeline settings have Replace typed values with fake data (e-mail, names, phone…). With it, the values you typed in fields that say what they hold (their type, their name or label, the browser's autofill hints) become columns of a person set, in the language of the pages you typed in. Some values stay as you typed them, because a random one would not work: the account of a login form, the choice of a drop-down list, and a reference recognized only by its format (an order number). Each typed value of the review shows the fake data it would get, and its Use as list can choose Fake data for one value only. Passwords are never replaced: they stay project secrets.

From Postman

Importing a Postman collection turns its dynamic variables {{$randomFirstName}}, {{$randomEmail}}, {{$randomPhoneNumber}}, {{$randomCity}}… (14 of them) into columns of a postman set. One difference is reported: Postman draws a new value at each place the variable appears, the set one per iteration.

Ask the assistant

The assistant knows the generators and their options: "add fake French customers, 70% women aged 18 to 30, and send their e-mail in the sign-up request" builds the set, checks the preview and uses the columns.

Good to know

  • Values are generated by the load generators during the test: there is nothing to upload and no limit of rows.
  • E-mails use example.com unless you choose another domain. A real domain gets a warning: test e-mails sent to real domains would reach real people. Its fix Use example.com changes it in one click.
  • A value has at most 4,096 characters.
  • A test using fake data needs a runner image built after fake data existed. A custom runner image built before is refused with the message to rebuild it (Runner images page). Browser checks of monitoring run fake data only on Swarmetry's browser image.
  • Bank account numbers (IBAN) and card numbers are not generated: use One of a list with the test numbers of your payment provider.