Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
5.6.0, 5.13.1
-
None
Description
References:
I happen to know (because I've used it in the past) that the QTest framework has ways to let me invent file names
- for data files used by the test, relative to the source directory
- for scratch files used in testing, relative to the build directory
I see no mention of these tools in the overview, [0].
In the QTest details [1], I do find mention of QFINDTESTDATA(), which implements the first of these (and looks in the second while it's doing so).
I am unable to find the second documented.
We should encourage developers to write tests that, when they create files, do so in the build tree (in preference to the source tree, when different); to that end, we should publicise the means to do so. Without that, many tests clutter source trees with stray files (that we end up having to list in .gitignore or adapt test clean-up code to tidy away; which doesn't work so well when a test fails on an assertion and bypasses its clean-up).
I think it would be worth adding a section to the overview, dealing with convenience facilities for accessing data files, creating names that can safely be used for scratch files used in testing and best practice for choosing such names.
Attachments
Issue Links
- relates to
-
QTBUG-63987 qtestlib doc: create a section on common patterns and good practices
- Reported
Gerrit Reviews
For Gerrit Dashboard: QTBUG-55531 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
280302,1 | WIP: Doc: Accessing test data on disk | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |