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

From Qt Wiki
Revision as of 17:59, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

English Spanish Български

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.

Categories: