Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. test
    Log in to post

    • SOLVED QSignalSpy report wrong number of emitted signal
      General and Desktop • signal test qtcore qsignalspy • • sardylan  

      4
      0
      Votes
      4
      Posts
      29
      Views

      I managed to solve the problem. The cause was my mistake in understanding how signals works in test environment. During tests I have no EventLoop running, so the signal-slot mechanism of Qt can't work. De facto, every time the assign method execute, I was emitting a signal using a Qt:QueueConnection, but there was no EventLoop running to process the signal queue. Every time I call a setter method in test code, the next line have to be: QVERIFY(signalSpy->wait()); which waits, no more than 5 seconds, running an internal EventLoop to process all emitted signals, and waiting for signals of the same type declared in QSignalSpy instance. Since I had some methods with signal checks and some with only simple code checks (but both of them emit signals) I had a continuous jump between methods with and without QSignalSpy usage. Since no EventLoop is running on tests, when I called the wait method on QSignalSpy instance, I was getting all the queued signals emitted on the previous test method, which also explain why I was getting constant numbers on signal counts. I was not able to resolve just calling signalSpy->clear() in cleanup method because there was nothing to clear. One solution could be to run the EventLoop between every tests method, just to be sure that the next test will handle only signals emitted in its code. I resolved the problem implementing signals checks in every test method, which not only was my initial goal, but which ensure that every signal-emitting code is followed by a call to wait() method, which runs the EventLoop. Every signal, now, is kept inside the test method and everything seems to works. Thanks for support
    • UNSOLVED Help with Autotest for Gerrit submission
      General and Desktop • test qt sources gerrit processevent • • oblivioncth  

      4
      0
      Votes
      4
      Posts
      38
      Views

      @oblivioncth said in Help with Autotest for Gerrit submission: So I should just add the cases locally, ensure they test correctly, and then commit --amend & push the changed test file as part of the rest of my submission? That's correct yes.
    • SOLVED Source files compiled multiple times with Qt Test
      General and Desktop • test qtest qtestlib • • Maluna34  

      3
      0
      Votes
      3
      Posts
      224
      Views

      Oh yes, it's logic. Thanks !!!
    • SOLVED Correct project structure for QTest with qbs.
      General and Desktop • qbs test undefined refer qttest • • john9947  

      2
      0
      Votes
      2
      Posts
      213
      Views

      I found a solution for the issue: Simply split the main() from the rest of the Project . Here is the updated Production Code Product specification: import qbs Project { name: "TheRealApp" QtApplication { name: "TheApp" Depends { name: "cpp" } Depends { name: "library" } Group { name: "Main" files: [ "main.cpp", ] } } StaticLibrary{ name: "library" Depends { name: "cpp" } Depends { name: "Qt.core" } Export { Depends { name: "cpp" } cpp.includePaths: product.sourceDirectory } Group{ name: "Grp_Main" files: [ "mycustomclass.cpp", "mycustomclass.h", ] } } }
    • UNSOLVED Qt Testing on Android
      Mobile and Embedded • android qt 5 test test automation • • francescmm  

      2
      0
      Votes
      2
      Posts
      446
      Views

      Hi, IIRC, you can't directly do that. However, there where some scripts in the qtqa repository to run the tests in the CI, you might be able to leverage that. Hope it helps
    • UNSOLVED OpenGL context and testing with catch2
      General and Desktop • opengl test context • • BePie  

      1
      0
      Votes
      1
      Posts
      286
      Views

      No one has replied

    • UNSOLVED Autotest doesn't find any tests ("Test Results" window is empty)
      Tools • creator test • • Abstraction  

      6
      0
      Votes
      6
      Posts
      2832
      Views

      I've partialy analysed AutoTest code. For QTest it checks if given source file (after macro preprocesing) has QTest include and QTest::exec() somewhere in code. In my case it lead to usage of TestRunner modified to store function object #define DECLARE_TEST_RUNNER(className) \ namespace { \ int executeTestClass(int argc, char* argv[]) \ { \ className test; \ return QTest::qExec(&test, argc, argv); \ }; \ static char test_##className = \ TestRunner::Instance().RegisterTestClassRunner(executeTestClass); \ } Macro is placed at begining of each CPP file with test details (to decouple as much as possible) However Autotest still acts strangely. Sometimes it discover tests, sometimes not. I believe that it may search in source context of currently selected run target. PS: When I expanded one of DECLARE_TEST_RUNNER macro - AutoTest start displaying green arrows. Not before. Building main exe or ut.exe isn't helping. Calling 'Refresh test' from Tools->Tests also doesn't help. I still don't know what triggers test gathering. PSS: In each test binary at least one QTest::qExec should be expanded out of MACRO. From this point - AutoTest shows also test runners hidden in MACRO and run then all.
    • UNSOLVED Testable - QML Unit Test Utilities
      Showcase • test • • benlau  

      2
      2
      Votes
      2
      Posts
      1598
      Views

      Nice ! Thanks for sharing :)
    • UNSOLVED Qt Data Driven Test row name
      General and Desktop • qt5.6 test data qtestlib • • diredko  

      6
      0
      Votes
      6
      Posts
      2012
      Views

      Nice one ! I've missed that function. Thanks !
    • UNSOLVED TUG Framework: open-source GUI Unit Testing for Qt applications
      Showcase • test testing unit tests quality • • pedro_mateo  

      1
      0
      Votes
      1
      Posts
      1176
      Views

      No one has replied

    • Test available module
      QML and Qt Quick • module test available • • CharlieG  

      2
      0
      Votes
      2
      Posts
      722
      Views

      Hi @CharlieG AFAIK that is not possible from QML. But you can try checking for errors by loading the QML from C++ side. For eg. if you use QQmlComponent you can check for errors using errors.
    • SOLVED QCOMPARE failing for doubles on Qt 5.5 only
      General and Desktop • qt5.5 test double • • Paul Colby  

      7
      0
      Votes
      7
      Posts
      3341
      Views

      @Paul-Colby Thank you for reporting back. This is very important info for people using this function as "stuff" will happen if you upgrade from older Qt.
    • [Solved] QTest issue creating object to test with
      General and Desktop • c++ qt 5.4 qsqltablemodel test • • Sam2304  

      6
      0
      Votes
      6
      Posts
      3782
      Views

      @Sam2304 you are welcome Well, sometimes "we programmers do not see the forest because of trees" ;) Glad, that it worked out for you.
    • Testing the mouse cursor shape
      General and Desktop • gui test qt test • • Victor P.  

      2
      0
      Votes
      2
      Posts
      697
      Views

      Hi and welcome to devnet, reading from docs QWidget::cursor() should do the job. Have you tried it?