Starting the Test Data Generation Wizard

Before invoking the Test Data Generation wizard, you must decide which table to use to generate the data.  After this determination has been made, right-click the desired table in the Catalog Details window and then click Generate test data.

 

 

The following window displays:

 

Example scenario

In order to understand all the steps required to create test data, the following example is provided, including the steps used during the process.

The example scenario uses the following E-R diagram of a database table:

In this example, Microsoft SQL Server 7.0 is used, and all the data types reflected are for this type of database.

Deciding which tables to populate first

When you have multiple tables in your database, it is important that you populate data for the primary tables first. Primary tables are tables that do not have any foreign key constraints defined. Therefore, data can be generated without depending on other entities. In our example, the Customers, Employees and Products tables fall into this category.

The following steps describe the test data generation process:

1          From the Catalog Details window, select the Customers table.

2          Right-click this table and then click Generate test data.

3          Click New to create a new template.

Note: Default values are supplied for all fields. If you click Next until completion, WinSQL Professional generates about 1000 table rows.

4          Click Next. The following window displays:

The options on this window allow you to select fields and the data formats for the fields you wish to generate. Field names are displayed on the left side of the window.

Four data sources can be used, described in the following table:

 

Data source

Description

Random data

This option generates completely random data. Although the text will not make any sense, this is the fastest method to generate data. This is the default value for all the fields except if there is a unique index on the field, in which case unique numbers will be generated.

Formatted data

This option allows you to select the format of the data. Depending on the data type of the field, available options can change. For example, if the data type is DATETIME, you can specify the starting and ending date. Additionally, you can specify if you wish to include time along with date.

For detailed information about how to use formatted data, see the “Specifying Formatted Data” topic.

Read from another table

This option is useful if you have a foreign key constraint defined that references another table.

WinSQL Professional queries the ODBC driver to determine if any foreign key constraints are defined. If found, the program automatically selects this option with appropriate values for the fields. This feature depends heavily on the capabilities of the ODBC driver. For example, the ODBC driver for Microsoft Access does not return this information to the application, and users manually have to specify these values.

Read from a text file

Use this option to read data from a text file. This text file MUST have one row per line and can have multiple columns separated by a | (pipe) character. You can either sequentially read the file or assign records randomly. In the case of a sequential read, there MUST be enough records in the input file.

Tokens

Data in one text file can be a source for multiple columns. Consider the following scenario:

You want to insert city, state & zip information in a table. If these three fields come from three different text files, there would be no relation between city, state and zip. This can cause New York City to become part of California with a zip code of Orlando, Florida. To avoid this situation, WinSQL Professional can read multiple fields from a text file. These fields are separated by a | (pipe) character and are called tokens. A sample text file can look like:

New York City|New York|10001

Woodbridge|Virginia|22192

Palo Alto|California|94301

5          After your selections have been made, click Next.

6          Based on your data source selection, different additional options as presented to you. Make sure selections, and then click Next. A summary window similar to the following displays:

7          Select one of the following options:

·Run Only

·Run & Save

·Save Only

8          Click Generate. WinSQL begins to generate records in your back-end database.