DISCLAIMER: I'm quite new to Qt, QML and SailfishOS development.
But after researching for a while, I didn't find a flawless way to test QML applications.
- testing framework: QtTest with
TestCase
QML type- write tests in javascript
- tests can be run in 2 different ways:
- C++ harness with
QUICK_TEST_MAIN
macro - qmltestrunner (separate program, can be depended on as a package)
- C++ harness with
- separation of test data & release build
- test data (eg test DBs) don't need to be shipped
- test requirements (e.g. qmltestrunner) only for test package
- helper methods for controlling Silica components: According to this guide
- project structure compatible with QtCreator autocomplete (not like this approach where import paths have to changed between dev and build)
- How to setup lower-level parts of the test environment? (e.g. change attributes of the QQmlEngine)
- supplying test data to LocalStorage is an own story on itself I openened a Qt Issue on
- Testing QML components on SailfishOS (original Russian version
- uses qmltestrunner
- describes helper functions to add for controlling Silica components (as they seem to be missing currently)
- problem: no separation of test package and release app: tests & test data need to be shipped, dependency on qmltestrunner
- example helloworld project structure by ArtemMarchenko
- uses a subpackage for separating test data from production/ release code
- problems:
- complex project structure: needs changes in Spectacle yaml file which can't be done from QtCreator itself (file is hidden there)
- import paths need to be changed during development for QtCreator auto-correct to work, then changed back before build
- C++ testrunner is basically 1 macro call -> hard to customize/ setup additional stuff
Thank you. Any updates on this after August? The situation is not too good IMO