Tag: QtTest

Testing QTableWidget with QTest

In the last post I talked about how to integrate tests in the build environment. When we talk about testing I always think on unit testing for my classes and methods but I usually forget UI testing.

With Qt we have a really nice environment to test GUI as well. Widgets implement all the power of signals and slots, and Qt provides a wide range of signals so we can keep track of what happened and what’s currently happening. The fact that we can work with QSignalSpy makes all or testing easier. At least if we know what to test, because some times is not that straight-forward with widgets. Specially with QListWidget, QTableWidget and QTreeWidget classes.

In the Qt5 repository we can finde a lot of tests for those classes:


Integrating Qt Test in Travis CI

For a long time I wanted to create a full Continuous Integration environment that uses Qt for both building apps and testing. In fact, one of the most important things for me was to find the right way to integrate Qt Test. For CI I’ve started to use Travis since it is one of the most widely used environments in GitHub. I took that decision after seeing other Qt projects (Musescore and Stellarium) using it.

The main difference between those projects and the one I wanted to set up, is that they’re using CTest as a testing tool. With that tool they can report when the tests are broken easily. But, how the hell I was going to do it with Qt?