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

QTest::qExec - better support for multiple test suites

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 4.7.4
    • Testing: qtestlib
    • None
    • All

    Description

      When using QTest::qExec with command line arguments - calling a specific test, listing test functions - it works only with one test suite (see sample below).

      To implement better support for multiple test suites there should be an API function like "int QTest::qExec(QList<QObject*> testObjects, int argc = 0, char** argv = 0)". Furtermore there should also be an API function to get a list of all available test functions like "QStringList QTest::testFunctions(QList<QObject*> testObjects)" .

      Sample code, -functions argument will not list "test2" as a test function so there is no possibility to run it individually:

      // test suite 1
      class Test1 : public QObject
      {
      Q_OBJECT
      private slots:
      void test1()

      { QCOMPARE(true, true); }

      ;
      };

      // test suite 2
      class Test2 : public QObject
      {
      Q_OBJECT
      private slots:
      void test2()

      { QCOMPARE(true, false); }

      ;
      };

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);

      Test1 t1;
      QTest::qExec(&t1, argc, argv);

      Test2 t2;
      QTest::qExec(&t2, argc, argv);

      return 0;
      }

      Attachments

        Issue Links

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

          Activity

            People

              jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
              qtcomsupport Qt Support
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes