[Interest] make check not working (macOS)

Kai Köhne Kai.Koehne at qt.io
Wed Jun 23 17:45:24 CEST 2021

HI Jason,

It looks to me like you're trying to add a test case into your normal application executable. Is that correct?

The canonical use of QTest is different: You create a separate project for the tests, in a separate directory. If you e.g. check back on https://doc.qt.io/qt-5/qttestlib-tutorial1-example.html , this creates a new file testqstring.cpp, and then uns "qmake -project" in the directory to create a completely new project.

Hope this helps.


-----Original Message-----
From: Interest <interest-bounces at qt-project.org> On Behalf Of Jason H
Sent: Wednesday, June 23, 2021 5:08 PM
To: interestqt-project.org <interest at qt-project.org>
Subject: [Interest] make check not working (macOS)

It's been a while since I use QtTest, and never on MacOS.

I am following the tutorial at: https://doc.qt.io/qt-5/qtest-overview.html and https://doc.qt.io/qt-5/qttestlib-tutorial1-example.html

Changes from existing project:
QT += testlib
CONFIG += testcase no_testcase_installs
HEADERS += test_sqldatabase.h

Added a test_sqldatabase.h, containing:
class Test_SqlDatabase: public QObject { ...
private slots:

#include "moc_test_sqldatabase.h" // the tutorial says #include "testqstring.moc" But it looks like the moc naming convention change

// end of test_sqldatabase.h

When I run `qmake && make check` it just executes the main program

What did I miss?
the make target is:
check: first
        .../target_wrapper.sh $(TESTRUNNER) ./$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET) $(TESTARGS)

Which makes me think TESTRUNNER is not being set?

Interest mailing list
Interest at qt-project.org

More information about the Interest mailing list