GUI testing

Similar to testing classes that perform a specific task, it is also possible to create Unit Tests that are meant for testing GUI functionality or a widget's behavior. The only difference in this case is that GUIs need to be provided with mouse clicks, key presses, and similar user interactions. QTest supports testing GUIs created with Qt by simulating mouse clicks and other user interactions. The following functions are available in the QTest namespace to write Unit Tests capable of performing GUI tests. Note that almost all of them rely on the fact that all widgets and GUI components in Qt are subclasses of QWidget:

  • keyClick: This can be used to simulate clicking a key on the keyboard. This function has many overloaded versions ...

Get Computer Vision with OpenCV 3 and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.