Zsombor Erdődy-Nagy
Zsombor Erdődy-Nagy

Reputation: 16914

How to avoid the need to generate tremendous amounts of test data during TDD? (mocking a database)

I'm getting used to TDD, but up to this point I only had to deal with developing relatively small applications with it. But now, I'm in a project that deals with a huge database, with complex schemas.

When I'm writing the tests, I find myself typing in tremendous amounts of test data. How would a testing guru avoid this?

Right now it seems quite hopeless to develop the part of the application that displays/handles this data with TDD because of this.

Upvotes: 1

Views: 75

Answers (2)

pkoch
pkoch

Reputation: 2722

You should only generate enough data to characterize the application's state you want to test, and that's not avoidable. You have to setup your environment before you test it.

Have I misunderstood the question?

Upvotes: 1

TrueWill
TrueWill

Reputation: 25563

AutoFixture might do what you need, if you use .NET. (Disclaimer: I have no experience with it other than reading blog posts.)

There are test data generators available that target other languages, databases, platforms, etc. Some randomize, some allow you to specify patterns for data generation.

Upvotes: 1

Related Questions