Multiple pro file project with QTests
Unsolved
General and Desktop
-
Hi,
I would like to add tests in my project, so that when compiling and running the main program, the tests are also run. I found a project on github that show how to do it using the main pro file and other pro files in subdirectories. Unfortunately, the tests are not performed when starting the program. How could I make the tests run before starting the program, or make then the application is build?
Code on github:
https://github.com/vivaladav/BitsOfBytes/tree/master/gui-unit-testing-with-qt-test-advanced/GuiUnitTestingAdvmain .pro file:
TEMPLATE = subdirs SUBDIRS += \ WidgetsLib \ TesterPanelConcat \ ExampleApp lib.subdirs = WidgetsLib tests.subdirs = TesterPanelConcat app.subdirs = ExampleApp app.depends = lib tests.depends = lib
other .pro file 1:
QT += widgets TARGET = WidgetsLib TEMPLATE = lib DEFINES += WIDGETSLIB_LIBRARY DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ PanelConcat.cpp HEADERS += \ PanelConcat.h \ WidgetsLibGlobal.h unix { target.path = /usr/lib INSTALLS += target }
other .pro file 2:
QT += widgets testlib TARGET = TestPanelConcat CONFIG += console CONFIG -= app_bundle TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS INCLUDEPATH += \ ../WidgetsLib LIBS += \ -L../WidgetsLib \ -lWidgetsLib SOURCES += \ TestPanelConcat.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\"
other .pro file 3:
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = ExampleApp TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS INCLUDEPATH += \ ../WidgetsLib LIBS += \ -L../WidgetsLib \ -lWidgetsLib SOURCES += \ main.cpp \ MainWindow.cpp HEADERS += \ MainWindow.h