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: