MSDN Magazine - October 2008 - (Page 11) SCOTT MiTChell Toolbox Realistic Test Data, Dare Obasanjo’s Blog, Color-Coding Tools, And More Create Database Test Data When building and testing a data-driven application, it is important that the data in the development database is an accurate reflection of the data that will be used in production. Having similar amounts and types of data during development and production helps designers to better evaluate user interfaces, developers to judge how well the system will scale, and testers to build test cases based on more realistic scenarios. It also helps to have realistic data for demos and sales presentations. While you can write your own SQL scripts to generate test data, a much easier and faster approach is to use SQL Data Generator (version 1.1) from Red Gate Software. With a few points and clicks of the mouse, SQL Data Generator can generate millions of records with realistic values, and customizing the generated data is a cinch. To get started, launch SQL Data Generator and create a new project, which displays the Project Configuration wizard. From here you select the server and database, indicate whether to have any custom SQL scripts execute before or after the data is generated, and choose an assortment of options, such as whether to fire INSERT and DELETE triggers and whether to enforce CHECK constraints. After choosing the database and options, SQL Data Generator displays a three-pane interface. The left pane lists the tables in the database and enables you to select which tables will have data generated for them. Selecting a table from the left pane loads information about that table in the right two panes. The top-right pane summarizes the data-generation settings for the table. Here you can choose how many rows to add, SQL Data Generator Generates and Customizes Data Records whether to delete the table’s data before adding the generated data, and what action to take if attempting to insert invalid data. The bottom-right pane shows a preview of the data that will be generated. To customize the data for a particular table column, select that column from the left or bottom-right panes. This loads the column’s settings in the upper-right pane. From here you can indicate whether the generated values for this column should be unique and what percentage of values should be NULL. You can also specify how the data is generated to ensure that it contains realistic values instead of just random strings, numbers, and dates. You can pull data from a .csv file, a SQL query, a weighted list of possible values, or from a regular expression. Alternatively, you can pick a category, such as colors, e-mail addresses, first names, last names, addresses, cities, postal codes, credit card numbers, company names, or URLs, and SQL Data Generator will use predefined values that belong to that category. While you certainly can choose how each column in every table is generated, the good news is that SQL Data Generator makes an educated guess at the appropriate value based on the table and column names and data types. For example, when generating data for a string-based column Send your questions and comments for Scott to toolsmm@microsoft.com. All prices were confirmed August 21, 2008, and are subject to change. The opinions expressed in this column are solely those of the author and do not necessarily reflect the opinions at Microsoft. October 2008 11
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.