|
What are you validating when you try to drive a database from tests? Is it the database, itself,
or the way a database is built?
When you write tests for an application, even though they execute against binaries,
they actually validate the source code used to build those binaries. Doesn't
it stand to reason that tests for a database should really be validating the means by which that database was built? Of course, that only works when your database
build scripts are reliable...
Getting to version one is easy. All you need are acceptance and unit tests
- the same kind of thing that you probably already do for application logic.
Since you start with nothing, your tests start out implicitly validating how version
one of a database was made.
It's getting to version two that is the real trick, isn't it? Acceptance tests
and unit tests only validate the functionality of a database once it is fully built,
taking for granted the thing that made the database what it is. The two most
common techniques are having pre-configured test servers or building up test servers
on the fly using a single SQL script that represents the current state of the database.
How does either of those techniques resemble reality? Do we drop all of our
tables in production and build a brand new database with every version? Are
we going to manually manipulate the production server through some designer tool?
In reality, most people generate an untested delta script at or near the last possible
minute and have DBAs apply it by hand. So what really got tested in that case?
We end up validating how things would have worked in the ideal case, rather than
what will actually happen.
DataConstructor
changes all this by letting you easily create a critical third kind of test:
the transition test. Transition testing doesn't replace unit or acceptance
testing, it supplements them. Transition testing gives you confidence in how
you got to the current version and how you will get to the next version.
Because you are no longer testing an ideal database and, instead, are testing what
will actually happen in production, you can achieve a truly test-driven database.
Click here
to learn more or
start your free 30-day trial now.
|