PDA

View Full Version : Project structure with qtestlib



matteonardi
30th March 2010, 16:38
I have a project with many small classes which i would like to test, I'm using qmake and qtestlib.
Reading qtestlib's manual I got the impression that the common way to test classes is to use the QTEST_MAIN() macro, which expands into a main function. This means i must create a project file for every class.

How can I avoid creating so many project files just to test small classes?

My possible solutions would be:
- Covering different small classes in one test (But I'd prefer to keep classes separated)
- Writing my own main function which in turns calls the others functions
- Maybe reimplementing QTEST_MAIN to better suit my needs

I'd really like to get advises about this... What would you do? How are your projects structured?

matteonardi
1st April 2010, 08:01
I finally found a solution to this here:
http://lists.trolltech.com/qt-interest/2008-09/thread00129-0.html

I removed all the QTEST_MAIN macro and I created a single file with a main function calling QTest::qExec() on all my test classes.