Qt testlib
-
Hi,
I'm trying to write a test for a simple project following this tutorial : http://doc.qt.io/qt-5/qttestlib-tutorial1-example.htmlthis i my .pro , so i'm testing simplebackend and the tester class is test_simeplebackend in folder Tests
QT += quick testlib CONFIG += c++11 QT += opcua QT += network DEFINES += QT_DEPRECATED_WARNINGS SOURCES += main.cpp \ simplebackend.cpp \ Tests/test_simeplebackend.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target HEADERS += \ simplebackend.h \ Tests/test_simeplebackend.hThis is the output i have when i do :
/myTestDirectory$ qmake -project "QT += testlib" /myTestDirectory$ qmake /myTestDirectory$ mingw32-makeOutput :
c:\Users\lev\Documents\QIHM\Tests>mingw32-make mingw32-make -f Makefile.Release mingw32-make[1]: Entering directory 'C:/Users/lev/Documents/QIHM/Tests' mingw32-make[1]: *** No rule to make target 'release/test_simeplebackend.moc', needed by 'release/test_simeplebackend.o'. Stop. mingw32-make[1]: Leaving directory 'C:/Users/lev/Documents/QIHM/Tests' Makefile:36: recipe for target 'release' failed mingw32-make: *** [release] Error 2I can't figure out what i'm doing wrong.
test_simeplebackend.moc should be automatically generated right ?Thanks
-
this is the .pro that is automatically generated in Tests directory
QT += testlib TEMPLATE = app TARGET = Tests INCLUDEPATH += . DEFINES += QT_DEPRECATED_WARNINGS HEADERS += test_simeplebackend.h ../simplebackend.h SOURCES += test_simeplebackend.cpp ../simplebackend.cpp -
Hi,
I would recommend to switch to the subdirs template and properly separate the projects.
This will allow to have a cleaner and easier to maintain structure.
-
Hi,
I would recommend to switch to the subdirs template and properly separate the projects.
This will allow to have a cleaner and easier to maintain structure.
-
i will do this : http://xilexio.org/?p=125
-
i will do this : http://xilexio.org/?p=125
@LeLev you may want to take a look at, for instance, Qt MQTT module and how things are arranged there.
examples qtmqtt.pro src sync.profile tests |-README.txt |-auto |-benchmarks |-common |-tests.proand tests.pro is like this:
TEMPLATE = subdirs SUBDIRS += auto contains(QT_CONFIG, release): SUBDIRS += benchmarks -
@LeLev you may want to take a look at, for instance, Qt MQTT module and how things are arranged there.
examples qtmqtt.pro src sync.profile tests |-README.txt |-auto |-benchmarks |-common |-tests.proand tests.pro is like this:
TEMPLATE = subdirs SUBDIRS += auto contains(QT_CONFIG, release): SUBDIRS += benchmarks@Pablo-J.-Rogina thx for the suggestion, i will definitely take a look at this exemple.
The link i pasted http://xilexio.org/?p=125 is also (for me) very interesting, i organised my app following the concepts described there.