One of the most problematic part of any new development is to make sure that you test your application with data that is near real life. 90% of the cases developers just test with a couple of rows of data that they enter and the data is rarely diverse enough or similar to real life data.
There are a number of data generator tools out there in the market, but they are costly and development teams rarely get the budget to buy these tools. There are a number of random data generation free-wares, but most of these are developed over a weekend hacks and though they generate random data, I don’t think they are representative of most real life data (Who actually has a name like “$ssoghetn2u#a”).
Few people know that Visual Studio Database Edition has a set of tools to generate test data. Called Data Generators, you can add a data generation plan to your database project and use that to generate test data. It ships with multiple data generators and you can also write custom data generators very easily. Since the Database Edition is now available with the developer and some of the other editions, it is easy to use by most developers.
I actually started writing a data generation application that can generate real life representative data a couple of years back. As is the fate of a number of those weekend projects, this went into hibernation once I ran into time issues and then was forgotten.
Then a couple of months back I started playing around with the Visual Studio Team System (VSTS) Database Edition and then remembered I had some code that I had written for the original data generator and so started looking into writing custom data generators for VSTS DB. There is not too much data on writing custom generators and most of the blogs are out of date. So if you want to write custom generators, I would point you to MSDN.(That information is quite good and you should be able to get up and running quickly)
I was surprised at how the VSTS DB custom generator interface was so similar to what I had come up with and so started writing a couple of data generators based on the code I already had. After a couple of weekends, I had my first couple of custom data generators.
Note: These are written for VS 2008 SP1 and Database Edition GDR R2. I am not sure if this will work for GDR 1. (I suspect it will as the interface for custom data generators have not changed).
This EnhancedDataGenerator currently contains two DataGenerators:
1. FirstNameGenerator – Generates real-life First Names
2. LastNameGenerator – Generates real-life Last Names
These are also locale aware and currently support two locales en-US and de-DE. So based on the locale this generates different kinds of First and Last Names. (Locale is a property in each generator, so you can generate English first names and German last names, if that is what you want). If you have data for common First and Last names in other cultures, please send them to me and I will update the database to handle those cultures too. (The maximum time I actually spent was to search for and get the base data into a format that I can import into the database)
The FirstName Generator is also Gender aware.
A couple of screenshots of these at work:
EnhancedDataGenerator Setup – Setup File that will deploy the files to the default VS install location (Don't use if you had used a custom path to install Visual Studio)
Other Things to Notes
1. Error Handling is not great. I have not yet found a way to report errors to the IDE user. So as of now if there are any errors, nothing happens. E.g. if you set the locale to anything other than en-US or de-DE, you just get empty data back. So if no data appears, that means you have an error .
2. The setup kit has not be fully tested. So if this does not work for you, use the DLL kit and do a manual deploy
3. Retain the directory structure inside the zip file when doing manual deploy
3. If your Visual Studio is installed to a custom path (not <prog Files x86>\Microsoft Visual Studio 9.0, then you will have do a couple of more things.
a. Use the manual depoy method and get the Extensions deployed in the VSTSDB\Extensions
b. Change the config file setting DBPath to point to the Database directory inside your custom extensions directory.
4. The .Extensions.xml file is already created with the correct data, so you will not have to create those again when doing a manual deploy.