Test and Sample Data

I need sample / test data all the time. When ever I build an application for a client it is useful for testing and demonstrating, when I teach a course it's always useful to have a demo database on hand (I'm a bit bored of Northwind and Pubs).

Over the years I've collected all sorts of useful sample data, like real surnames, first names and place names. All I've lacked is something to randomly pick from those lists to create a dataset ready to import (in the format I need at the time).

During some free time I had recently I decided to build a generator, but I wanted something really flexable, so what I built uses a template to determine what the output should look like. For example, if all you wanted was a CSV list of names you could do something like this:

{title}, {firstname}, {lastname}

If you wanted to insert those names into a database, then maybe generating the SQL insert statements would be more useful:

INSERT INTO People (Title, FirstName, LastName) VALUES ("{title}", "{firstname}", "{lastname}")

You can also insert numbers, guids, values picked from lists, patterns of characters, greeking text and of course real UK streetnames, towns and counties (with random but real looking postcodes).

If you think this will be as useful to you as it is to me, you can find it here:

Edit: Thanks to Eric Nelson for linking to the test data generator, both from the MSDN Flash newsletter and his own blog.

kick it on DotNetKicks.com

This article is part of the GWB Archives. Original Author: DarrenFieldhouse

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.