PDA

View Full Version : Qt Creator Testing and debugging my library with Qt Creator



Luc4
31st May 2011, 21:47
Hi! I'm writing my library with Qt Creator using Qt classes. Qt Creator compiles and link it and I indicated in the makefile to place it in a target directory. Now it is time to test it, so I'm writing a small application (with GUI) that links to the library and tests the APIs. What I'm finding bothering though is that this way I'm missing a way to debug it using the debugging functionalities of Qt Creator.

Moreover this way, any time I need to fix something I have to rebuild and to reinstall the library to have both the binary and the headers deployed in the correct situation.

Is there a more comfortable way to test the application? Maybe I should create my test classes inside the same project and then change the makefile so that the output is no more an app but a lib? How do you do the testing?

Thanks!

Luc4
1st June 2011, 19:16
For the moment I found a possible solution: I created a new directory which will contain my test tool. I created the classes I need inside there and I included the files in a .pri file. Then, in the main .pro file, I used a new config value to switch between the library and the test application. This way it should be simple to switch between the deploy of the lib and running the test tool. Something like this:


CONFIG += MAKE_LIBRARY

!MAKE_LIBRARY {
include(myTestTool/myTestTool.pri)
TEMPLATE = app
}
else {
TEMPLATE = lib
QT -= gui
}

But I suppose this is not the best possible idea. There should be something better. If anyone knows please share!