Aqua 2024.3 Help

Generate test data

Some tests rely on test data, and Aqua can generate it for you. It might be names, dates, email addresses, passwords, hostnames, and so on. You can quickly insert a single entry or use more advanced options to generate massive files in CSV, JSON, or any other custom format.

Generate a literal

  1. Place the caret where you want to generate a literal and press Alt+Insert. The generated literal appears at the caret.

    Generate a literal
  2. From the menu, select the type of data that you want to generate.

    Select the type of data to generate

In addition to predefined dictionaries, you can use a custom one.

Create a custom dictionary

  1. Press Alt+Insert. From the menu, select Custom, then Configure Custom Data Generators.

    Configure Custom Data Generators
  2. Add a new generator, give it a name, and select Dictionary for the type.

    Create a custom dictionary type generator
  3. Specify the dictionary entries in the Expression field. Each entry is placed on a separate line. You can preview an example of the generator output in the Result tab.

  4. If you want to use this dictionary in a complex generator, for example, to generate massive amounts of data in an arbitrary format, specify the Variable name. You can later use this name to refer to this dictionary. Otherwise, you may leave this field blank.

The Test Data plugin also supports regular expressions. To use them, you have to create a regex-based generator.

Specify a regex for test data generation

  1. Press Alt+Insert. From the menu, select Custom, then Configure Custom Data Generators.

    Configure Custom Data Generators
  2. Add a new generator, give it a name, and select Regex for the type.

    Create a custom regex type generator
  3. Enter the regular expression in the Expression field. You can preview an example of the generator output in the Result tab.

  4. If you want to use this regex in a complex generator, for example, to generate massive amounts of data in an arbitrary format, specify the Variable name. You can later use this name to refer to this dictionary. Otherwise, you may leave this field blank.

After you have specified a custom dictionary or a regex, they appear in the Generate menu under Custom. You can use them to generate literals just like with the predefined generators.

Custom generators

If you need to generate multiple entries in a specific format, that's also possible. The Test Data plugin allows you to create a custom generator that handles bulk data generation and custom formats.

Generate a bulk of test data

In order to generate multiple entries, you have to create a custom template. The steps below cover the full procedure that includes creating a template. Once you have one, you can skip the configuration step.

  1. Press Alt+Insert. From the menu, select Custom, then Configure Custom Data Generators.

    Configure Custom Data Generators
  2. Add a new generator, give it a name, and select Multiple for the type.

  3. Specify Expression. It will be used to generate individual entries. Within the expression, you can use any of the predefined variables as well as custom dictionaries and regular expressions that have been assigned a variable name.

  4. Specify Prefix, Delimiter, and Postfix. These will apply to each expression result when multiple entries are generated. For example, if a single entry generated by the expression is a JSON object, these settings will combine such objects into a higher level structure (for instance, an array).

  5. In a text file or a text block, press Alt+Insert. From the menu, select Custom, then select the newly created generator.

    Create a custom multiple type generator
  6. Specify the number of entries to generate.

Last modified: 03 December 2024