Details
-
Technical task
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
Description
Auto tests in Qt have been written with various flavours of qtestlib, with the same test functions mixing several styles. Subsequent tests are frequently added by copy-and-paste from other tests, including bad practices. Over the years this have resulted in non-optimal and flakey tests. Create a section in docs on common patterns and good practices. This page later could easily be extended when discovering other anti-patterns found during fixing flakey and other odd looking tests.
Reduce fragmentation by merging https://wiki.qt.io/Unit_Testing and https://wiki.qt.io/Writing_Unit_Tests into this official documentation. Wiki pages is a lazy way of documenting things properly. Note: the contents of these wiki pages needs to be evaluated when moving to the official documentation.
There should also be a subsection on debugging techniques. See https://codereview.qt-project.org/#/c/208303/5/src/testlib/qtesthelpers_p.h for an example of what this section could contain.
End result of this task would be a single point of a reference for new contributions of tests.
Attachments
Issue Links
- relates to
-
QTBUG-61967 Order of QWindow expose and activation not specified
- Open
-
QTBUG-55531 QTest documentation lacks details of how to invent file names
- Open
-
QTBUG-18368 Document coding standards for automated tests
- Closed
Gerrit Reviews
For Gerrit Dashboard: QTBUG-63987 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
277183,6 | Doc: Add guidelines for writing Qt tests | 5.13 | qt/qtbase | Status: MERGED | +2 | 0 |
277670,6 | Doc: Update info about building tests | 5.14 | qt/qtbase | Status: MERGED | +2 | 0 |
277675,4 | Doc: Add best-practice-info for using QVERIFY() and QCOMPARE() | 5.13 | qt/qtbase | Status: MERGED | +2 | 0 |