Automated integration testing a C++ app with a database Automated integration testing a C++ app with a database database database

Automated integration testing a C++ app with a database


How are you verifying the results?

If you need to query the DB (and it sounds like you probably do) for results then I agree with Kris K, except I would endeavor to rebuild the DB after every test case, not just every suite.

This helps avoid dangerous interacting tests

As for tools, I would recommend CppUnit. You aren't really doing unit tests, but it shouldn't matter as the xUnit framework should give you the set up and teardown framework you'll need to automatically set up your test fixture

Obviously this can result in slow-running tests, depending on your database size, population etc. You may be able to attach/detach databases rather than dropping/rebuilding.

If you're interested in further research, check out XUnit Test Patterns. It's a fine book and a good website for this kind of thing.

And thanks for automating :)

Nick


You can dump/restore the database for each test suite, etc. Since you are automating this, it may be something in the setup/teardown functionality.


I used to restore the database in the SetUp function of the database related unit test class. This way it was ensured that each test runs under the same conditions.

You may consider to prepare special database content for the tests, i.e. with less data than the current production version (to keep the restore times reasonable).