Simplifying Data-Driven Testing With TestComplete's Automatic Data Generator

Data-driven testing is a powerful technique that allows you to verify your applications against many different sets of test values. Rather than creating an individual test for each case, you simply bind your test to the data source it will run through. The benefit is that it’s easy to add more test cases when needed and to update the test in case the test steps change in the future. That’s why data-driven testing is considered an automated testing best practice.

The Challenge

So you decided to data-drive your test. You examined your tested application and noted the various value types that are inputted into the forms – names, addresses, phone numbers and so on. Now you need to make up dozens, maybe hundreds (or maybe even thousands?) of test data records. Sounds easy at first, but it’s getting a little complicated as your imagination runs out after an hour of tedious work. The problem also is that often you can’t use live data because of the privacy concerns.

The Solution: Test Data Generator

We wanted to make better use of your time rather than manually creating and populating the test data source, so we built the test data generator into TestComplete. This cool new tool lets you quickly generate arbitrary amounts of realistic test data in a variety of formats you may need. Whether you need a simple list of names or a large data table, the data generator is just the tool for the job.

In this post, I’ll give you a quick overview of the data generator and how to use it.

How to Use the Data Generator

To open the data generator, select Test | Generate Data from TestComplete’s main menu, or click the Data Generator button on the toolbar. This brings up a wizard that will step you through the generation process.

First, you select the data source you want to save the generated values to. You can choose between an Excel file and a table-type test variable.

After you have decided on the data source, now comes the interesting part – the actual configuration of the data generator. Here you specify the number of rows and columns for the resulting data table and select the generators for individual columns.

The Data Generator Wizard

There are 19 built-in generators for various data types – names, e-mail addresses, city and country names, SSNs, dates, numbers and much more. There’s also an all-purpose custom string generator that allows you to generate values in arbitrary formats that aren’t available out of the box and to combine values from multiple generators.

Each generator has configuration options for selecting the data format – for example, full names vs. first names vs. last names, minimum and maximum values of a range, repeatable vs. random values, and so on. You can tweak the default settings and instantly preview the sample generated values to find what suits your needs best.

Settings of the Random Generator

Need to generate random values from a custom list? No problem, use the Value From a Set generator to enter the original values and select the generation mode. Or you can write the original values down to a text file and feed this file into the generator – that’s a very handy way of re-using your own data.

Settings of the List Generator

Once you’re happy with the configuration, click Finish to start data generation. In less time than it takes you to get a cup of coffee, you’ll have a ready Excel file or a data table variable filled with random yet realistic data. You can see an example on the image below.

Generated Data

You can put this data to use right away and turn your tests into data-driven tests by binding them to the generated data source. The time you save from using the data generator instead of filling out the data source manually can then be spent on more important and interesting tasks.

To see the test data generator in action, download TestComplete 8.10 now. If you’ve already tried it, leave your comments below to let us know how it works for you. And keep an eye out for more details about the latest TestComplete release!


Close

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox

By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading