Automated testing?

Hello,

I’m trying to do a simple stupid app (for the moment) to remember qml and c++. And currently I wished to add some unit tests, and I don’t found a way to have it.

I found there is the QtQuick in the qml, but when I don’t see how to run it (also the qml was not my specific target) and if I try to add a file of test like is commented in the qt tutorial: Chapter 1: Writing a Unit Test | Qt Test 5.15.4 the qttest is not found in the include

Somebody did some automated testing? How did you get it running?

Thanks,

2 Likes

Maybe you forgot to add QT += testlib in your .pro file.

You would also need to add build time dependency on qt5-qttest-devel for C++ and run time dependency on qt5-qtdeclarative-import-qttest for QML in your .spec/.yaml I think.

Hi,

unfortunately testing is a much neglected topic in SFOS (at least it is hard to find good documentation).
I have some tests in my project (see GitHub - andywuest/harbour-watchlist: A stock watchlist for SailfishOS) - there i have c++ tests as well as tests for some javascript functions - however no qml UI tests (for that you would need some more changes to the codebase). Feel free to use my project as a starting point. Just have a look at the tests and tests_qml directories. c++ is a bit ugly because you have to create a pri file that is included by both, your project and the test project - but in general it works.

Cheers,
Andy

Thank you both,

I didn’t get time to try it. Maybe we can create somewere some tutorial of how to add testing in sailfish os? There is some place that can be contributed in the documentation? (Or in the worst case, create a small sample project, with documentation)

What do you think?

Thanks,
Jaume.

1 Like

an update from my side:
if one follows that: Running Autotests | Qt Creator Manual
he will end up here:

NOTICE: Using the ‘SailfishOS-4.3.0.12-i486.default’ snapshot of the build target
Fatal: No spec or yaml file found in ‘/home/pawel/Documents/SailfishProjects/olive-goes-shopping-test/rpm/’
07:38:14: The process “/home/pawel/.config/SailfishSDK/libsfdk/build-target-tools/Sailfish SDK Build Engine/SailfishOS-4.3.0.12-i486.default/qmake” exited with code 1.

will check out the link above