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

Provide a more pervasive equivalent of QTest::ignoreMessage()

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.4
    • Testing: qtestlib
    • None
    • All

    Description

      As milianw pointed out in a recent mail to development, some projects have to test in environments where there are unavoidable messages they have to put up with, whose source and triggers are not under the test's control.
      To alleviate this, we could provide some mechanism for the test (ideally as early as the test-object's construction, certainly no later than initTestCase()) to register some messages or regexes, that'll suppress all matching messages in the whole test run, rather than only the first such in the present test function.

      QTest registers its message logger in QTest::qInit(), at the start of QTest::qExec(), after the test-class has been instantiated and QTest::setMainSourcePath() has registered relevant paths. It deregisters it in QTest::qCleanup(), at the end of QTest::qExec().
      So QTest can only suppress such messages in that interval.

      Failure to produce such messages should not be an error (as it is for ignoreMessage()), but perhaps verbose test runs could report, when finished, how many were suppressed – including reporting that none were, if that happens, so that test maintainers can tell when they no longer need such suppression.

      Attachments

        Issue Links

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

          Activity

            People

              macadder Jason McDonald
              Eddy Edward Welbourne
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes