Forum Discussion

luisanillo's avatar
luisanillo
Occasional Contributor
6 years ago

At What Frequency Does WaitProperty Checks For Property

I'm currently doing performance tests on a desktop application and I realised that times are not the same when I do the test manually versus when I use TestComplete.

 

Let's say I'm looking at the time it takes to send results to server after clicking a button. What I do in my code is once the button to trigger the operation is clicked, wait for the result window to appear in order to stop the stopwatch.

 

I'm getting higher execution time with Test Complete than manually testing (I record the screen, capture the time where I click the button and the time where the window appears to be as precise as possible). Note that the difference of time is significant; around 30 to 40% depending on the amount of data transfered.

 

var ResultsDialog = Aliases.Sys.TxpApplication.TCCHPDFCreatedList;
ResultsDialog.WaitProperty("Exists", true, 100000);
  
if (!ResultsDialog.Exists) 
{
  Log.Error("Results dialog is not visible after timeout");
}
 
ResultsDialog.ButtonPanel.ButtonCancel.Click();

My question is how often does Test Complete tries to check the "exists" property ?  I have a feeling that it does it at a high frequency, which results in the environnement being overcharged and thus performing it's current operation slowly.

 

I read the documentation, with no succes, I couldn't not find a parameter to set a frequency.

 

I know I could use a loop and add manual delay to it, but I would like to avoid that.

 

Thanks!

 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I'm not sure any of us schmo users will be able to answer that question.  There is no "frequency" setting but you have to assume that it is often enough and rapid enough to return a result quickly.

    As for "Exists"... I would not use WaitProperty for Exists.   Think about it... how do you call the WaitProperty method on an object that does not exist and, therefore, does not have a WaitProperty method?

     

    Waiting for existance is better done with a WaitChild, WaitAliasChild, or other similar "Wait" method that actually waits for the object.  You can also use Find, FindEx, FindChild, and FindChildEx.

    • luisanillo's avatar
      luisanillo
      Occasional Contributor

      The object was mapped before hand, so I'm assuming that it knows of it. By waiting for exists, I know that once it's property is set to true, it will be visible.

       

      You may ask why not check for visible, and it is because it fails, since the object does not exists and thus, does not contain a proprerty visible yet.

       

      For you answer about the frequency, I assumed it was quick, but that is the problem. This operation takes around 1 to 2 hours. Imagine querying that property, let's say, 3 times per second. That will surely slow down the whole system, and thus, explain why my results are over what I obtain in manual testing.

       

      Edit: about WaitChild and others, will it do the same as WaitProperty but for an object ? By reading the documentation, I have a feeling that yes it does, therefore, my question still applies; at what frequency and how do I change it ?

       

      Thanks for showing interest in my question!

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Mapped <> Exists.  Existance has to do with whether or not the object exists in your machine's memory.  That's what WaitChild and WaitAliasChild do.  

         

        This is the better way of checking existance

         

        var myParentObject = Aliases.MyApp.MyParent
        
        if ((myParentObject.WaitAliasChild('MyChildObject', 1000).Exists) {
            Log.Message("My object exists within 1 second")
        } 
        Else {
            Log.Message("My object was not present in memory after 1 second")
        }

        Using WaitProperty means you're putting TestComplete through the cycle of trying to find first of all find the object whose property you're checking before it can call the WaitProperty method.