What unit testing framework should I choose for cross platform C++ development.

Preferably (in order of requirements):

  • facilitate the repeated testing of user interface elements in Qt (or other GUI frameworks).
  • be as simple as possible to create new tests.
  • be easy to automate the testing during all phases of the development cycle (from internals to GUI).
  • output it's results in a place which is nicely formatted or is easy to format.
  • support the test driven development paradigm.

This question came up a lot in Stack Overflow questions, but that is the wrong forum for this question, and many of the answers don't actually give any details about the individual frameworks.

2 Answers 2


It sounds like you are mostly concerned with testing the GUI elements, (there are many test frameworks for testing the execution but not so many for the GUI).

One cross platform solution for testing the GUI elements is sikuli - it is a python test framework but since it relies on image recognition for the test actions and some results it should also work nicely for testing of C++ based GUIs, you would just have to compile your test framework or application before starting the tests.

  • Free
  • Cross Platform
  • Uses image recognition to locate items to click on, input fields, etc.
  • Can use image recognition to confirm actions
  • Does not require access to GUI internals such as field identifiers or element IDs.
  • I am a big fan of Sikuli, and I use it already. If I was looking purely for GUI testing this is my preference. On the other hand, there are parts of the internals that don't need to have a GUI element, but all parts should be tested. I'd love an all-in-one unit-testing framework. Good suggestion, though.
    – Poik
    Commented Sep 2, 2014 at 0:52
  • 2
    I don't know of a single good test framework that does both good unit test and gui test. Commented Sep 2, 2014 at 5:07

You may want to look at our company's tool Squish for Qt. It supports testing of Qt applications since 2003 and recognizes both QWidgets and QtQuick elements. On all platforms that Qt runs on.

Image-based interactions are possible as well. But nothing beats knowledge of specific control types build into a test tool a-priori.

Reports are available in either HTML, XML, JSON or Excel formats.

If you are after GUI testing in a test-driven manner I suggest to take a look at BDD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.