Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-55531

QTest documentation lacks details of how to invent file names

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: 5.6.0, 5.13.1
    • Fix Version/s: 5.13
    • Labels:
      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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              docteam Qt Documentation Team
              Reporter:
              Eddy Edward Welbourne
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes