This documentation is archived and is not being maintained.

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 Premium or Visual Studio Ultimate 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.Tools.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.

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.

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 Visual Studio Premium or Visual Studio Ultimate.

Try more advanced techniques for generating data: You can follow this walkthrough to create custom data generators 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.

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

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

Generating 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.