How to test PyQt/QML applications?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to test PyQt/QML applications?

Alexander Rössler-2
Has anyone been successful with testing QML code and PyQt components
together?

When I try to run a QML file that contains a TestCase I get an module
"Qt.test.qtestroot" not installed error.

In general, I would prefer being able to test the QML application from
Python, any ideas how this could be done? Currently I use pytest +
pytest-qt for the non-GUI stuff.

--
Alexander Rössler
HMI Expert at Rössler Systems
Tel: +43 680 1348338
Web: https://roessler.systems
Blog: https://machinekoder.com
[hidden email]
Lebnergasse 1/7/7
1210 Wien - Austria
ATU72251528
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: How to test PyQt/QML applications?

Cody Scott-2
You can use qmltestrunner, but you have to register your Python types so that qmlscene and qmltestrunner can use them[0]. To register them you need to use the pyqt5qmlplugin and to get that you need to build PyQt5 from source[1].

Here is an example of how to structure your code as a plugin[2]. I will take a look but I think the problem with the second commit in that repo is that you have to import the first level first.
So before importing import QEMEL.Objects 1.0 as QO it needs to have import QEMEL.





On Thu, Jun 21, 2018 at 5:23 AM, Alexander Rössler <[hidden email]> wrote:
Has anyone been successful with testing QML code and PyQt components
together?

When I try to run a QML file that contains a TestCase I get an module
"Qt.test.qtestroot" not installed error.

In general, I would prefer being able to test the QML application from
Python, any ideas how this could be done? Currently I use pytest +
pytest-qt for the non-GUI stuff.

--
Alexander Rössler
HMI Expert at Rössler Systems
Tel: +43 680 1348338
Web: https://roessler.systems
Blog: https://machinekoder.com
[hidden email]
Lebnergasse 1/7/7
1210 Wien - Austria
ATU72251528
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt