Generate Specialized Test Data with a Custom Data Generator
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Generate Specialized Test Data with a Custom Data Generator

By creating a custom data generator, you can generate test data that meets your organizational needs but that you cannot generate through the built-in generators. You can use custom data generators with the generators that are contained in Visual Studio Team System Database Edition to generate realistic test data that does not disclose sensitive information. To create a custom data generator, you use the classes in the Microsoft.Data.Schema.DataGenerator namespace.

In the following table, you can find descriptions of common tasks that support this scenario and links to more information about how you can successfully complete those tasks.

Common Tasks

Supporting Content

Get hands-on practice: You can follow the introductory walkthrough to become familiar with how to create and register a simple custom data generator.

Walkthrough: Creating a Custom Data Generator

Learn about data generator extensibility: If you are creating your first custom data generator, you might want to learn more before you begin. You can learn about the data generation process, the types of data generator extensibility, and the relationships between data generators, data distributions, and data generator designers. You can also learn about how to name your generator and how to automatically assign input properties.

An Overview of Data Generator Extensibility

Considerations for Custom Data Generators

Create a custom data generator: To create a custom data generator, you create the project for it and then specify input and output properties for that generator. After you build the generator, you must register it before you can use it in Database Edition.

How to: Create Custom Data Generators

How to: Add Input Properties to a Data Generator

How to: Add Output Properties to a Data Generator

How to: Register and Manage Feature Extensions

Try more advanced techniques for generating data: You can follow this walkthrough to create custom data generators for a check constraint.

Walkthrough: Creating a Custom Data Generator for a Check Constraint

Deploy custom data generator: After you verify that your generator works correctly, you can distribute it to your team. You can ask each team member to install and register the feature extension manually, or you can create a simple installation program for it.

How to: Distribute Custom Feature Extensions to Team Members

Use custom generator as the default for a SQL data type: You can change the default generator that is used for a specific SQL data type by specifying a custom generator.

How to: Change the Default Generator for a Column Type

Troubleshoot issues with generating data: You can learn more about how to identify and resolve common problems with data generators.

Troubleshooting Data Generation Issues

Generate Test Data for Databases by Using Data Generators

Before you run database unit tests, you should use a data generator to create realistic test data without exposing production data to your developers.

© 2015 Microsoft