Generate synthetic data
Generate random test data with the built-in faker object for names, emails, and numbers.
Random test data helps you get past unique-field constraints, such as sign-up forms, without typing new values by hand each time.
The faker object is not available
Maestro exposes a global faker object that wraps the DataFaker library (faker.name().firstName() and similar calls). maestro-runner, and therefore Astra Scout, does not include it. A flow that calls faker fails with a JavaScript error. Use one of the options below instead.
Built-in random input commands
For the most common cases, use the dedicated commands. Each types a random value into the focused field:
| Command | Generates |
|---|---|
inputRandomEmail | An e-mail address |
inputRandomPersonName | A person's name |
inputRandomNumber | A number |
inputRandomText | Random text |
- tapOn: "Email"
- inputRandomEmail
- tapOn: "Name"
- inputRandomPersonNameThese commands type the value but do not hand it back to the flow. If you need to type the same value again later, for example to log in with the account you just created, generate it in JavaScript and keep it in output.
Generate values in JavaScript
Plain JavaScript is enough for unique identifiers, numbers, and dates. Store the result in output so later steps can reuse it:
- evalScript: ${output.suffix = Math.floor(Math.random() * 100000)}
- evalScript: ${output.email = 'qa+' + output.suffix + '@example.com'}
- tapOn: "Email"
- inputText: ${output.email}
# ... later in the flow
- assertVisible: ${output.email}For longer logic, put it in a script and run it with runScript:
// randomUser.js
const chars = 'abcdefghijklmnopqrstuvwxyz';
let name = '';
for (let i = 0; i < 8; i++) {
name += chars.charAt(Math.floor(Math.random() * chars.length));
}
output.user = {
name: name,
email: name + '@example.com',
timestamp: new Date().getTime()
};- runScript: randomUser.js
- inputText: ${output.user.email}Related content
- Manage data and states: share generated values with the
outputobject. - Run and debug JavaScript: the three ways to run JavaScript in a flow.
