Writing Unit Tests

From Qt Wiki
Revision as of 08:53, 8 November 2019 by Leenamiettinen (talk | contribs) (Moved info to the Qt Reference Documentation and added links here.)
Jump to navigation Jump to search


Whenever you fix a bug, please add a regression test for it: this is a test (ideally automatic) that fails before the fix, exhibiting the bug, and passes after the fix. Whenever you implement a new feature, please add tests that verify that the new feature works as intended. Once you've written and committed your tests (along with your fix or new feature), you can check out the branch on which your work is based then check out into this the test-files for your new tests; this lets you verify that the tests do fail on the prior branch.

The Qt Test best practices will be part of the official Qt reference documentation starting from Qt 5.13.3 (or if there will be no such release, from Qt 5.14.0). A snapshot is available here: Qt Test Best Practices.

Some information was moved to the documentation of the respective macros and functions in the Qt Test documentation snapshot for 5.13.3.

You can find the latest version of the Qt Test documentation here.