Applies to TestComplete 14.30, last modified on November 21, 2019

Sometimes, you may need to have certain test data that will be entered in a specific window or control of your tested application. Usually, creation of such test data is very tiresome and requires a lot of time. To make it easier to create such test data, TestComplete now includes a special data generator that assists you in generating random test data of certain types: integer numbers, names, dates and so on.

Below are some tips on creating typical test data via the data generator.

Generating Random Passwords

To generate passwords, select the String data generator in the Data Generator column of the Data Generator wizard. Click Edit, and then set both the minimum and maximum character values to 8 (or to any other number, depending on how long you want your passwords to be). TestComplete will generate random values that can be used as a password. For instance, it can generate the following string - KAb1f`Y}.

Generating Titles for User Names

Using the TestComplete data generator you can generate titles for user names, like Dr., Mr., Mrs. and Ms. For this purpose, select the Value from a Set data generator in the Data Generator column of the Data Generator wizard. Click Edit and then add each title to the list of Custom Values. Then set the Generation mode to Random so that each user gets a different title. You can do the same thing for name suffixes, like Sr., Jr., III, and so on.

Toggling Checkboxes on and Off

To toggle checkboxes, select the Boolean data generator in the Data Generator column of the Data Generator wizard. Generate values and then create a data-driven loop that manipulates the checkbox and sets its Checked property equal to the generated value.

Building Custom Sentences

Sometimes, there is a need to enter some text, for example, in the Comments section. Instead of typing "My Comment", you can have TestComplete combine data types, like an IP address and City, to automatically generate statements like "127.1.1.1 is located in Boston.". For this purpose, use the Custom String data generator.

Generating Birth Dates

To generate birth dates, select the Date and Time data generator in the Data Generator column of the Data Generator wizard. Then click Edit, choose Custom from the Date/time format drop-down list and enter MM/dd/yyyy in the Date/time format string edit box. Choose Random from the Generation Mode drop down window and then choose a value like 1/1/1945 from the Minimum Value drop down window.

Generating Integer Numbers of a Certain Length

To generate integer numbers of a certain length, select the String data generator in the Data Generator column of the Data Generator wizard. Then click Edit and set the minimum and maximum character values to 3, for example (or specify any other number). Then uncheck all the boxes, except for Digits.

Generating Address Information

Using the TestComplete data generator, you can generate city names, street addresses and so on. However, if you need to generate a compound address, such as Apt 23 B and Suite 122, you can do this via the Custom String data generator.

For this purpose, select the Custom String data generator in the Data Generator column of the Data Generator wizard. Click Edit and then enter the following string in the Value edit box:

%SET(Apt,Suite,Site) %Str(1,3,D) %Str(1,2,L)

This specifies a set of data (Apt, Suite, Site) that will be randomly chosen from, a 1-3 digit string that will give a numeric to the apartment, suite or site that gets chosen, and a 1 or 2 letter suffix.

Creating User-Defined Generators

To create a user-defined generator, do the following:

  1. Configure one of the standard generators as you wish. These settings will be used for the created user-defined generator.

  2. Click Save to User-Defined under the Sample field.

  3. Specify the desired name for the created generator in the subsequent dialog and click OK to close it.

  4. TestComplete will automatically add the specified generator to the Data Generator list. This generator will correspond to the standard generator with the settings specified before you clicked Save to User-Defined.

    After you create a user-defined generator, you can use it as any other predefined generator and it will be available to any TestComplete project that is opened on your machine.

For more information on user-defined generators, see Working With User-Defined Data Generators.

For more information on using the TestComplete data generator, see Using Data Generators.

See Also

Using Data Generators
Data Generator Wizard
Generators

Highlight search results