The Data Generator dialog assists you in editing table variables. Using this dialog you can specify the parameters needed for populating the desired variable with generated test data. The wizard is called when you do any of the following:
Click Populate the column with randomly generated data on the toolbar of the Variable’s default value page of the Data-Driven Loop operation’s wizard.
Select the Generate data type and then click the ellipsis button within the Value or Settings column of the table shown on the Table generation page of the Data-Driven Loop operation’s wizard.
Click Populate the column with randomly generated data on the toolbar of the Table Variable editor.
The dialog’s view depends on the way you have called it. Below, is an image that demonstrates a sample view of the dialog:
Specifying Data Generator Parameters
Using the dialog, you can specify additional settings for the generated data that will be stored to the specified table variable. To do this, follow the steps below:
Specify the number of rows in the created data storage. For this purpose, use the Number of rows setting.
Note: If you called the dialog from the Data-Driven Loop operation’s wizard, you can set the number of rows for all the columns in this wizard. For this purpose, close the dialog and use the Data-Driven Loop wizard to modify this setting.
Switch to the Data Generator list and select the desired data generator. For a complete list of data generators, see below.
If you want each generated value to be repeated several times, select the Duplicate each value check box and specify the number of each value’s duplicates.
After you specify the needed parameters, you can obtain the sample values that have been generated by the engine. The values are displayed in the Sample field.
Also, you can discard all the changes you made in the generator’s parameters and restore the parameters set by default. For this purpose, click Set Default Values below the Sample field.
If you are going to use the same settings in several variables or if you configure one generator in the same manner from time to time, it is much easier to save the selected generator with the specified parameter values as a user-defined generator. For this purpose, click the Save to User-Defined button below the Sample field.
Click OK to generate values and save them to the variable. Otherwise, click Cancel.
TestComplete provides 19 data generators to generate different kinds of values. Also, TestComplete allows creating user-defined generators and adding them to the list of available generators (see Working With User-Defined Data Generators). Below is a list of predefined generators:
Creating User-Defined Generators
Besides the predefined generators mentioned above, TestComplete allows creating user-defined generators and adding them to the list of the available generators (that is to the Data Generator list).
Configure the desired generator as you wish. These settings will be used for the created generator.
Click Save to User-Defined under the Sample field.
Specify the desired name for the created generator in the subsequent dialog and click OK to close it.
TestComplete will automatically add the specified generator to the User-Defined category of the Data Generator list. This generator will correspond to the selected 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 open on your machine.
If you do not need the created generator anymore, select it in the Data Generator list and click Delete. This will remove the generator from the list of the available generators. Note that the Delete button is disabled for the predefined generators, so you cannot delete them.
For more information on using user-defined generators, see Working With User-Defined Data Generators.
For more information on generating random data with data generator, see Tips on Generating Typical Values.
For more information on preparing test data, see Preparing Data for Data-Driven Testing.