I finally found a solution which I want to report here, so that we can start a discussion and maybe improve the state of Qt Quick tests in QBS.
This is a toy project that shows what I did: https://github.com/synasius/prefect-qtquick-tests If you checkout the first commit and run "qbs build -p autotest-runner" it should fail because it's not able to resolve an import since the needed import path is missing. Then you can move to the latest commit and run the same command again and now the tests should pass. Basically I wrote a custom module that provides a property where one can add the needed import paths. Then I wrote a custom testrunner (copied and pasted from the original AutotestRunner) that takes into account the property of the module so it can run the tests with the additional import paths. I'd like some feedback. Maybe a similar approach can be provided by QBS out of the box using one of the existing module (Qt.qmltest for example). On Tue, 15 May 2018 at 16:25, Christian Kandeler <[email protected]> wrote: > On Tue, 15 May 2018 15:52:44 +0200 > Federico Frenguelli <[email protected]> wrote: > > > I'm not a QtQuick expert, but can't you just use the QML2_IMPORT_PATH > > > variable? > > > > > > AutotestRunner { > > > environment: base.concat("QML2_IMPORT_PATH=qrc:/qml") > > > } > > > > > > > I tried to use environment exactly how you proposed but somehow the value > > of QML2_IMPORT_PATH is processed and qrc:/qml is not added to the list. > > Interesting is that if I set environment to > > > > environment: base.concat("QML2_IMPORT_PATH=qrc:/qml:/home") > > > > this is the resulting list of import paths: > > > > View: QQuickView, import paths: > > > '/home/<user>/workspace/<project>/debug/tst-components-default.f0fbc580' > > 'qrc:/qt-project.org/imports' > > '/home' > > '/home/<user>/Qt/5.9.5/gcc_64/qml' > > > > qrc:/qml has been removed. > > Interesting. If you run qbs with "--command-echo-mode > command-line-with-environment", you can see exactly what environment qbs > passes to the application. > Although now that I think of it, the colon might be the problem, as > QtQuick probably interprets it as a path separator and then throws away the > "qrc" and "/qml" parts, because they are not existing paths. Maybe it's not > possible to provide qrc paths in this variable... > > > Christian > _______________________________________________ > Qbs mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/qbs > -- Federico Frenguelli
_______________________________________________ Qbs mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/qbs
