Skip to content

Instantly share code, notes, and snippets.

@schmittlauch
Created August 21, 2017 21:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmittlauch/172c39a9e669ece1e5a080a0869e7a87 to your computer and use it in GitHub Desktop.
Save schmittlauch/172c39a9e669ece1e5a080a0869e7a87 to your computer and use it in GitHub Desktop.

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.

current situation

  • 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)

current challenges for test systems

  • 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

guides/ tutorials I found:

  • 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
@olpeh
Copy link

olpeh commented Feb 5, 2018

Thank you. Any updates on this after August? The situation is not too good IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment