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

qvaluespace_jsondb should avoid using multiple test objects

    XMLWordPrintable

Details

    Description

      In qtsystems/tests/auto/qvaluespace_jsondb/tst_valuespace_jsondb.cpp, there are three test objects:

      int main(int argc, char *argv[])
      {
          QCoreApplication app(argc, argv);
      
          TestJsonDbPath pathTest;
          TestJsonDbHandle handleTest;
          TestJsonDbLayer layerTest;
      
          return  QTest::qExec(&pathTest, argc, argv) \
                  & QTest::qExec(&handleTest, argc, argv) \
                  & QTest::qExec(&layerTest, argc, argv);
      }
      

      Using multiple test objects in a single test program is discouraged, as clarified by the following paragraph recently added to the documentation for QTest::qExec():

      For stand-alone test applications, this function should not be called more
      than once, as command-line options for logging test output to files and
      executing individual test functions will not behave correctly.
      

      In the qvaluespace_jsondb test, only the output for layerTest will be visible if the test output is logged to a file (as is done by several of Nokia's CI systems, which then parse the test output into a database) and it will not be possible to manually run the test with command-line options for running specific test functions.

      If three test objects are needed (e.g. because the test is testing three classes or performing three different kinds of testing), a better approach would be to use three separate test programs, each containing one test object.

      Attachments

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

        Activity

          People

            xizzhu Xizhi Zhu (Steven)
            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes