This tutorial is an introduction to GUI unit testing with Qt Test. A working example is discussed and analysed in detail. Full qmake project and C++ source code are provided.
GUI unit testing with Qt Test
In this tutorial I will introduce GUI unit testing with Qt Test, the Qt framework for C++ unit testing. In particular I will discuss how to write a basic unit test for a widget class, how to simulate mouse and keyboard events and how to write data driven tests for GUIs.
This is the third post of a series dedicated to Qt Test. The posts of this series are:
Hi,
I getting an error as below:
error: cannot find -lWidgetsLib
error: ld returned 1 exit status
PS: Am using QT on Windows 10.
Thanks.
Are you using the Visual Studio compiler to build?
You can find a fix for Winbdows here : https://github.com/vivaladav/BitsOfBytes/issues/5
Thank you Davide for such a nice blogs on QT unit testing it has helped me a lot !!
Hello,
I am new to QT development.
In that mentioned example, you have divided actual application into ExampleApp and WidgetsLib. WidgetsLib included in both ExampleApp and TestPanelConcat applications.
But in my case, there is no library and the actual application has whole business logic. In this case how can i proceed to write test case for ui. Can you please explain how to proceed in this case with a nice a example if possible.
Thanks,
hello sir how u test code with no friend class i canot add class friend to code
TestPanelConcat is friend of PanelConcat:
https://github.com/vivaladav/BitsOfBytes/blob/master/gui-unit-testing-with-qt-test-introduction/GuiUnitTestingIntro/WidgetsLib/PanelConcat.h