Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QTestlib in qtbase doesn't work properly.

QTestlib in qtbase doesn't work properly.

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jitu
    wrote on last edited by
    #1

    Hi,

    I am trying to test qtmultimedia APIs and for that I am using QTest provided by QT itself.
    The location of QTest is qtbase/src/teslib.
    I am doing this testing on windows 7.

    In qtestcase.cpp class there is a function called qExec() which is required to be called from test class written by me.
    If qExec gets a fail result it clears the test case information by deleting it.
    But if qExec gets unhandled excepation then qtest will not clear test case information and in this case the test case with problem only will be repeated again and again.

    This causes my all test cases fail; in case of one bad test case also.

    I found that I can clear the test case in the case of unhandled exception then it works properly.

    I think this is a valid problem in QTest.

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      What exception is being produced? All test cases use the same memory space. If it's something like an access violation or stack overflow, then your memory is corrupted and qExec() can't recover.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jitu
        wrote on last edited by
        #3

        Hi,
        Thanks for the reply.
        I am testing multiple classes from QT using QTest.
        In this I am reading input and output using text files.
        I am creating and deleting the object of class for each test case (there can be multiple test cases for each API). So there is no chance of memory corruption.
        The problem is in handling the text files data from input files.
        For generating the negative test scenario; I introduced problem in input file.
        So in this case exception comes from qExec() and test case should fail; which is correct because i introduced the fail scenario.
        But remaining test cases for same API and other APIs should not fail.
        But qExec() doesn't clear the test case information for failed cases and keeps repeating the same test case for same API and other APIs.

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          Exceptions can cause stack corruption. Your code is executing the wrong function, which sounds like stack corruption. Can you post the code of the method that throws the exception? Also, if you throw your own exceptions, you should always catch them. Unhandled exceptions are nasty.

          Anyway, Qt Test is designed to mark pass/fail only by checking boolean results in QCOMPARE() and QVERIFY() -- it doesn't check exceptions. So, if you want to generate negative test cases, you need to catch your exception and then report that the expected exception was caught.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved