bye bye QtTestLib

and welcome QTestLib. If you follow the Qt 4.1 snapshots, you might have noticed that QTestLib appeared as part of Qt. To ease transition, there's a small updater tool (qtestlib/updater) that updates old autotests to use the new library.

Especially after being adopted by KDE, QTestLib got quite some feedback. Unhandled exceptions are now added to the test output and error reporting will stop after 2000 warning messages to prevent hanging tests from overflowing your harddrive. There were some API cleanups, especially the testdata creation was simplified a lot:

void MyTest::myFunc_data()

QTest::newRow("someTag") < < "someData" << 41;
QTest::newRow("otherTag") << "moreData" << 42;

Note that the QtTestTable parameter is gone. With a "using namespace QTest" declaration, it's even less to type :)

Blog Topics: