[Qt-interest] Using QTestLib with qt-eclipse

Martin Herrmann martin at famherrmann.de
Mon Jul 27 04:39:13 CEST 2009


Hi,


On Mon, 2009-07-27 at 00:13 +0200, Martin Tilsted wrote: 
> Is it possible to use QTestLib(testlib) with the qt-eclipse plugin?

Here's how I do it. This may not be a perfect solution, but it seems to
work.

In my main application, I have a function like this:

int runUnitTests (int argc, char *argv[])
{
QCoreApplication app(argc, argv);
Tests tc;
return QTest::qExec (&tc, argc, argv);
}

It is called from the main function when called with "--test":

int main(int argc, char *argv[])
{
if (argc>=2 && QString (argv[1])=="--test")
{
return runUnitTests (argc-1, argv+1);
}

// Regular main function...
}


Martin





More information about the Qt-interest-old mailing list