Data Generator Wizard

Applies to TestComplete 14.0, last modified on January 23, 2019

The Data Generator wizard assists you in creating data storages that contain test data. The wizard is called when you do any of the following:

  • Click Open Data Generator Wizard on the Tools toolbar.

  • Select Test | Generate Data from the TestComplete main menu.

The Data Generator wizard is included in TestComplete since version 8.10. If you have installed this TestComplete version or later over an earlier version in update mode, the Generate Data button may be unavailable on the Tools toolbar or in the Test menu as installing TestComplete in update mode does not update custom interface layouts.

You can add this command to the toolbar or menu manually by following the steps below:

  • Right-click the Tools toolbar or select Tools | Customize Toolbar from the TestComplete main menu.

  • In the ensuing Customize dialog, switch to the Commands tab.

  • In the Categories list, select the Tools category. In the Commands list, select the Generate Data command and drag it to the Tools toolbar or to the Test menu.

For more information on adding buttons to toolbars and menus, see Working With TestComplete Toolbars and Menus.

Specifying a Data Storage

On the first page of the wizard, you can specify the type of the data storage to be created. The following variants are available:

  • TestComplete variable - select this item to generate test data and store it to the specified project suite, project or keyword test variable. You can also specify the name, type and container for the new variable.

    Use the Variable name edit box to specify a name for the created variable. Note that the name can start only with a letter or underscore. The name can contain only letters, digits and underscores. If you specify an invalid variable name, an error will occur.

    Use the Variable type drop-down list to specify the type of a new variable. There are two available types: One value and Table. If you select the One value type, TestComplete will create a variable with one value only. The type of the variable value will be defined automatically after you choose the desired generator on the second page of the wizard. If you select the Table type, TestComplete will create a table variable with the specified number of columns and rows.

    Use the Variable container drop-down list to specify the storage the variable will be saved to. For example, if you select the MyProjectSuite_Name\MyProject_Name\KeywordTests\MyTest_Name item, the variable will be added to the list of the MyTest_Name keyword test’s variables. You can also create project suite and project variables.

    Note: If you call the Data Generator wizard while no project suite is open in TestComplete, you will not be able to specify a variable that will store the generated data. In this case, you can store the generated data to an Excel file only (see below).
  • Microsoft Excel worksheet - select this item to generate an .xls file with the specified number of rows and columns. You can also specify a location for the specified file. For this purpose, either enter the fully-qualified file name in the File Name edit box or click the ellipsis button and select the file via the standard Save To dialog.

    Open Microsoft Excel after wizard is finished - Select this check box to automatically activate the Excel editor with the created storage open in it after the data generation is finished. Otherwise, clear this check box.

    Before using Excel worksheets as a data storage, make sure Microsoft Excel is installed on your computer. If it is not installed on the computer and you try to choose a worksheet as a data storage, an error message is displayed.

    If you specify the name of an existing Excel workbook, TestComplete will add a new worksheet to this file and populate the created worksheet with the generated values. Otherwise, TestComplete creates the specified file, adds one worksheet to it and then populates this worksheet with the generated values.

After you have selected the desired data storage type and specified all the needed parameters (the name and so on), click Next.

Specifying Data Generator Parameters

On the second page of the wizard, you can specify additional settings for the generated data. The page appearance depends on the Variable type selected on the first page of the wizard.

Specifying Generation Options for the 'Table' Variable Type

In case of the 'Table' variable type, the second page contains the table that holds the descriptions of the columns that will be stored in the generated table or file. Each line in this table corresponds to one column of the data storage. The table contains the following columns:

  • # - Specifies the ordinal number of the column that will be stored to the table or file.

  • Column name - Specifies the title of the created column. You can modify the column’s content as you wish. To specify another column name, click within the corresponding Column name cell and enter a new name. To enter the specified name, press Enter.

  • Data Generator - Specifies the data generator that will be used to populate the created column with values. To change the value of this field, click within the corresponding cell in the Data Generator column, click the down arrow in the top right corner of the cell and then select the desired data generator from the ensuing drop-down list.

  • Parameters - Specifies additional parameters for the selected data generator. To modify these parameters, click within the Parameters cell to activate the in-place editor and press the Edit button. For more information on the parameters that are available for each generator, see the description of the desired generator (the Data Generators section below).

To specify additional settings for the data storage, follow these steps:

  1. Specify the number of rows in the created data storage. For this purpose, use the Number of rows setting.

  2. Click Insert to add a new column to the data storage. Each column of the data storage corresponds to one line that is added to the table shown on the wizard’s second page.

  3. Click within the Data Generator column and use the ensuing drop-down list to specify the desired data generator. For a complete list of data generators, see below.

  4. To specify a title for the created column, enter the desired string in the Column name cell. You can modify this name as you wish.

  5. Click within the Parameters cell to activate the in-place editor and press the Edit button.

  6. Configure the selected generator as you wish. For more information on the parameters available for the selected generator, see the generator’s description below.

  7. Click OK to close the dialog you used to configure the generator and then click Finish to generate the specified data and close the wizard. Otherwise, click Cancel.

Modifying the Columns List

All the columns that will be created and populated with the generated data are shown in the table on the second page of the wizard. Note that the order of the columns corresponds to the order of the columns after the data storage is created. That is, the first column will be the first column in the storage, the second column - the second and so on. So, to change the order of the column, use the Move Up and Move Down buttons.

To delete a column, select the desired column in the table and click the Delete button.

To save column names with the generated data, click Save column names.

Specifying Generation Options for the 'One Value' Variable Type

In case of the 'One value' variable type, the second page assists you in selecting the desired generator and configuring its settings. The page appearance depends on the generator type selected in the Data Generator field. For more information on the parameters available for the selected generator, see the generator’s description below.

Data Generators

To specify a data generator type, select the desired value from the Data Generator cell. TestComplete provides 19 data generators to generate different kinds of values. Also, TestComplete allows creating your own generators and adding them to the list of available generators (see Working With User-Defined Data Generators). Below is a list of predefined generators:

For more information on generating various data with the TestComplete data generator, see Tips on Generating Typical Values.

For more information on preparing test data, see Preparing Data for Data-Driven Testing.

See Also

Data-Driven Testing
Working With Databases
Working With Microsoft Excel Files
Data-Driven Loop Operation
Tips on Generating Typical Values

Highlight search results