Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Unit Testing
Jump to navigation
Jump to search
Unit testing with QTest
For a basic overview how to write unit tests with qtestlib, you should refer to the official manual. [qt.io]
Test Output
Output to a txt file
Output in xml format:
The above code will run the test and the output will be generated in xml format. The xml file can be parsed and the details can be displayed in an appropriate way as per the requirements.
Running and compiling QTests with CTest
CTest, by design, is only a facility for testing. For that it scales to very different unit tests frameworks, and works out of box with QTest.
The snippet below goes to CMakeLists.txt, and specifies files that are used for the test.