Forum Discussion

Sariali's avatar
Sariali
Contributor
14 years ago

synchronization between tc and application


hello!





tc fires a lot of commands to my test-application:

do command x1, do command x2, do command x3... get result

then: verify result.





but in some case the test-application needs time to handle the command.

therefore it is necessary to wait for test-application completation command x1

before sending command x2.





the way for waiting is to use "delay" in tc,

but this is not really a good style.









the solution cries for the design pattern "shake-hand-protokoll".

how do you handle this problem? 
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The best way to handle it is to use the various "Wait" methods available in TestComplete.  Complete command 1 and then wait for a page, wait for a form, wait for a component, wait for a component's property to change, etc.  You are correct, Delay works but it is not necessarily the best since, from one machine to another, the necessary delay time may vary.



    Check out the list of topics at http://smartbear.com/support/viewarticle/14495/

  • hi robert, thank you.





    i know the methods for waiting for an object with tc. i am not longer in the first class ;) ... but in the second! :) and still a novice as a tc-tester. 





    the subject is not to wait for an vcl-object. the problem is that the drawing of our timeline needs time and there are so many interactions in our software like update the thumbs, prepare gui-properties so that i can not really guess how much time etc. .... yes one of the other factor is the power of the computer.





    the test-application is definitifly in a clear state if there is no traffic inside! in other words: the process is on idle state.





    here i found a source to redirect the main process function to count up and down an idle-counter.

    (TApplicationEvents doesn't really work)





    http://forum.delphi-treff.de/showthread.php?18515-Alternative-zu-OnIdle/page2





    http://forums.about.com/n/pfx/forum.aspx?tsn=2&nav=messages&webtag=ab-delphi&tid=16716





    i am working now on implementing this solution in our tc-Helper 





    procedure WaitOnIdle;

    begin

      while gIdleCounter <> 0 do Sleep(100);

    end;





    this procedure exits if the process is on idle-state.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    the subject is not to wait for an vcl-object. the problem is that the drawing of our timeline needs time and there are so many interactions in our software like update the thumbs, prepare gui-properties so that i can not really guess how much time etc. .... yes one of the other factor is the power of the computer.




    This is still a factor of a Wait method.  There's a "WaitProperty" method that, if your component or timeline or whatever has a property that changes on completion, you can use "WaitProperty" to wait until that property has the desired value.