Reputation: 192
I am just starting out with QT and would like to have unit tests. I found a blueprint for a project structure that supports having tests outside my application.
For my first test I wanted to have a click on the "Quit" menu point, checking that the close action of QMainWindow is really called.
Coming from Java with all its mocking frameworks, here is what I would like to do:
I read the qtest tutorial, KDE documentation and other stuff on the net but I am not able to express that using qtest (yet).
I found Qt UI testing: How to simulate a click on a QMenuBar item using QTest? which describes a similar thing, but even there only 1, 2, 3 are covered (And I was not even able to get them to work).
So how can I write such a test case? Is that even possible?
Upvotes: 4
Views: 8520
Reputation: 137
For testing signal, the QSignalSpy class can be used http://doc.qt.io/qt-5/qsignalspy.html
But you want to test the whole application - not a single unit. For that a UI testing tool like squish or ranorex (both commercial) is way better suited.
Upvotes: 4