Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Running duration test/long term test/repetiting same test in qtuitestrunner
Forum Updated to NodeBB v4.3 + New Features

Running duration test/long term test/repetiting same test in qtuitestrunner

Scheduled Pinned Locked Moved Mobile and Embedded
16 Posts 4 Posters 5.9k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mhzaman77
    wrote on last edited by
    #7

    Hi,
    Thanks for the quick response. I put the loop after one instant is finished and before starting the 2nd instant as shown below:

    @
    testcase = {
    for (var i=0; i<10; i++){
    testFunction1: function() {
    wait (5000);
    startApplication("<path to qml viewer>", ["<path to test.qml>"]);
    var close = findWidget( {qmlType: "Rectangle"} );
    mouseClick(close);
    verify(getLabels().contains("Hello World!"));
    wait (5000);
    }
    }
    @

    still it is the same. Can u please correct me....
    Yes, in general works fine when there is no loop introduced.

    BR,
    Zaman

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kamalakshantv
      wrote on last edited by
      #8

      To me it seems like something is not closed properly. Check once you start qmlviewer it is closed properly before starting it again in the loop.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mhzaman77
        wrote on last edited by
        #9

        Hi,
        yes, without putting the loop - qmlviewer process is closed.

        Having the loop - I was thinking once the application is opened, then checking and after verification if there is some command to close the application which might help before initiating the next loop. - so far no clue....

        BR,
        Zaman

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mhzaman77
          wrote on last edited by
          #10

          Hi,
          guessing if there is any cleanup function to be used and how to...

          BR,
          Zaman

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kamalakshantv
            wrote on last edited by
            #11

            That's why I wanted to check if putting some wait helped and provided enough time to close the application. Any clue why with loop it didnt close

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dclark
              wrote on last edited by
              #12

              Hi Zaman,

              You have put the for loop outside the test function definition. If you put it inside testFunction1, does it work?

              I tried the following, which is similar to what I think you’re trying to do, and it works OK. This uses the photoviewer demo (note, the QTDIR and QT_SRC environment variables need to be set for this to run).

              @testcase = {
              photoviewer: function() {
              for (var i=0; i<10; i++) {
              startApplication("$QTDIR/bin/qmlviewer", ["$QT_SRC/demos/declarative/photoviewer/photoviewer.qml"]);
              mouseClick("Quit");
              }
              }
              }@

              Cheers,
              David

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mhzaman77
                wrote on last edited by
                #13

                Hi David,

                Thanks for the hints.

                For this specific photoviewer application there is a quit button which closes the application before it enters into the for loop for the 2nd instance. And it works fine.

                Now if you comment (//mouseClick ("Quit") - looping the appl. does not work. Gives an error note:
                QDEBUG : test::photoviewer(...) QtUiTest: couldn't listen for connections on 5656 : "The bound address is already in use" started : false

                for my application also it shows animated 'Hello world' text. After having a mouse click it changes the position. In test script after the application is opened - I guess I need to close this instant of appl. run before it goes for 2nd instant. i.e.
                @
                testcase = {
                testFunction1: function() {
                for (var i=0; i<10; i++){
                startApplication("<path to qml viewer>", ["<path to test.qml>"]);
                var close = findWidget( {qmlType: "Rectangle"} );
                mouseClick(close);
                verify(getLabels().contains("Hello World!"));
                wait (5000);
                // I guess I need to use some command/api to close the current run of the application before it enters into the loop for 2nd run
                }
                }
                }
                @

                Many Thanks.

                BR,
                Zaman

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mhzaman77
                  wrote on last edited by
                  #14

                  Hi David,
                  one update:
                  also the way tried as shown below does not work:
                  @
                  testcase = {
                  photoviewer: function() {
                  for (var i=0; i<3; i++) {
                  startApplication("qmlviewer", ["photoviewer.qml"]);
                  wait(1000);
                  enter("Brisbane", "Prague");
                  select("Add");
                  wait(1000);
                  enter("Oslo", findByProperty({ text: "" }));
                  select("Edit");
                  wait(1000);
                  var removeButton = findByProperty({ label: "Remove" });
                  for (var i=0; i<4; ++i) {
                  select(removeButton[i]);
                  }

                  mouseClick("Quit");
                  }

                  }
                  }
                  @

                  Thanks.
                  BR,
                  Zaman

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dclark
                    wrote on last edited by
                    #15

                    I was able to reproduce the problem, and I'll take a look at how to fix it. In the meantime, it is possible to use the test data mechanism to repeatedly run a test function.

                    The test data for each test function is just a JavaScript object, so it can be set using code. For example, this runs the photoviewer test function 20 times:

                    @testcase = {
                    photoviewer_data: {},

                    photoviewer: function() {
                        startApplication("$QTDIR/bin/qmlviewer", ["$QT_SRC/demos/declarative/photoviewer/photoviewer.qml"]);
                        print(getLabels());
                    }
                    

                    }

                    for (var i=0; i<20; i++) {
                    eval("testcase.photoviewer_data.run" + i + " = []");
                    }@

                    Hope this helps!
                    David

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mhzaman77
                      wrote on last edited by
                      #16

                      Hi David,

                      That`s great. Yes, test data mechanism works fine.

                      BR,
                      Zaman

                      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