14.15. Testing the client code

The C++ client code on the server is tested with:

The Qt Test C++ tests are kept separate to the code they are testing in the tests/auto sub-folder of tablet_qt. So for example, the tests for tablet_qt/lib/convert.cpp are tested by tablet_qt/tests/auto/lib/testconvert.cpp.

To build all of the tests:

cd /path/to/camcops
mkdir build-qt6-tests
cd build-qt6-tests
/path/to/qt_install/bin/qmake ../tablet_qt/tests

Then for example to run the lib/convert tests:


To run all the tests:

find . -path '*/bin/*' -type f -exec {} \;

If Qt reports missing dependencies, try:


A handy one-liner for building and running a test, reporting success or failure:

/path/to/qt_install/bin/qmake ../tablet_qt/tests && make && auto/lib/convert/bin/test_convert; if [ "$?" == "0" ]; then notify-send "Passed"; else notify-send "Failed"; fi