Previous Page
Next Page

Hack 94. Load Your Database with Test Data

Use predesigned test data that matches your tables and fields.

Building a database application is one thing, but testing it is another. Sometimes you can get your hands on archived production data and use it to test an application before it is released. Other times, though, you have to create your own test data.

Although putting a few records into your tables to make sure everything works accordingly can reassure you that your database application works, loading it with hundreds or thousands of records lets you really see how your application will perform when it's released.

Records2Go ( is a data-generation product that lets you define schemas and then produces data to your specifications. The created data is saved into an external text or XML file, which you can import into Access. You can make any number of records using this tool; I have used Records2Go to make records numbering in the hundreds of thousands.

Figure 9-14 shows how Records2Go works. You have a handful of settings to input, including how many records to make, what the created file is named, and where it will be saved. The form's main focus is the grid in which you define a table layout.

Figure 9-14. Creating an XML data set

You can create two types of files: text and XML. Figure 9-14 shows an XML schema being set up. Whether you're creating a text file or an XML file, each row in the grid represents a field. On each row, you enter the field name, field type, and other parameters. You can use standard field typessuch as numbers, dates, and textor you can use field types from a set of predefined data. The predefined data offers name and address field type information.

You can use wildcards to control how data is created. For example, when you select the Text type, you can enter a phrase, which will be created as is, or you can use specific wildcards to represent random numbers or characters. In the specification in Figure 9-14, pound signs (#) indicate random number creation.

Figure 9-15 shows the XML data generated from the specification shown in Figure 9-14. The predefined Full Name attribute created just that: XML attributes of names. The EmployeeID field is filled with random numbers, and the hire dates fall within the range in the specification.

Figure 9-15. The created XML data

Records2Go is great for producing large sets of data. Figure 9-16 shows a specification for making 15,000 text records. The task was completed in 33 seconds.

Figure 9-16. 15,000 records in 33 seconds

Figure 9-17 shows the created text file. One of the options is whether to include a header row. Other options include selecting the delimiter and the text qualifier.

Figure 9-17. Test data ready to be imported into Access

A great facet of the product is that you can save and load specifications. In other words, when you create a data specification in the grid, you can save it so that you can use it whenever you need it. You can move rows around in the grid, add rows, delete rows, and so on. You even can use just some of the rows and leave others outwithout having to delete them.

    Previous Page
    Next Page