Forum Discussion

Soumya's avatar
Soumya
Occasional Contributor
7 years ago

Autowait in TestComplete is not working though I set 100000ms for each task

Hi,

 

I used autowait for an element to load in my application But it  is not working.Though I set 100000ms for each task, it is not waiting for the element to load

 

Regards,

Sm

  • aPrivett's avatar
    aPrivett
    Occasional Contributor

    Here's a solution I use in keyword testing.: 

     

    1. Start a report running which might take up to 10 minutes to display in Crystal Reports Viewer
    2. Property Checkpoint on Aliases.Activity.ReportPreviewForm.ReportPanel.CrystalReportViewer.PageView.TabControl.DocumentControl.PageControl to see if it is enabled with Auto-wait of 600,000ms (10 minutes)
    3. Property Checkpoint again to see if it is Visible with autowait of 60,000ms (1 minute)
    4. Property Checkpoint again to see if it is VisibleOnScreen with autowait of 60,000ms
    5. Property Checkpoint Aliases.Activity.ReportPreviewForm to see if it is Enabled with autowait of 600,000ms
    6. Property Checkpoint Aliases.Activity.ReportPreviewForm to see if it is Exists with autowait of 600,000ms.

    If any of the Property Checkpoint fails, the whole test run fails, which is what I want.  No need to wait for the rest of the report to run when something is wrong with the application data.

     

    Why wait till the end to Checkpoint at the Form level (steps 5 and 6) you wonder?

     

    Days of trial and error led me to this order of operation. We are running a very old version of the Crystal Reports Viewer which may account for the oddity.  It is totally reliable on several hundred different kinds of reports for about 3 years now, every day.  I put this code in a keyword test that called by "Run Keyword Test" for every report.

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      aPrivett:

       

      Yes, your scenario describes what I and Robert were talking about.

      The only note that I have (yes, I understood that the mentioned sequence works reliably for you and you well may not want to change something in it) :

      I would swap steps 5 and 6.

      The reason for this is that if the object was found (i.e. the object was recognized by TC and found in its Object Tree), than its .Exists property is set to true. If the object was not found, than .Exists is false and any other property is not guaranteed to exist.

      The above means that if step 5 succeeds (form is enabled), then step 6 must definitely succeed (because the form exists and contains at least .Enabled property).

       

      P.S. Oh, and even more, if step 2 (that references Aliases.Activity.ReportPreviewForm.ReportPanel...) succeeds, then step 6 must succeed as well, because it references Aliases.Activity.ReportPreviewForm that was successfully resolved on step 2.

  • cunderw's avatar
    cunderw
    Community Hero

    Can you provide more information about what exactly is not working? How are you using it? We need more information to be able to help. 

  • Soumya's avatar
    Soumya
    Occasional Contributor

    In my application, when I enter the host name, it takes few seconds to check if that host is available, and then enables a button "Save Connection". Meanwhile TestComplete checks that the button is not enabled and it fails without waiting for the button to get enabled.

     

    So I tried giving timeout option by setting "Set autowait timeout for operations". I am expecting this to give a delay so that "Save Connection" button gets enabled.

     

    My problem here is "Set autowait timeout for operations" is not giving a delay. what should I do to give a delay here?

    • cunderw's avatar
      cunderw
      Community Hero

      How are you checking for enabled? My guess is you are trying to check the enabled property of an object that does not exist, so you need to wait for it to exist. Without more detail or a code snippet though, cannot tell for sure. 

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      > Meanwhile TestComplete checks that the button is not enabled

      How this is implemented in your test code?

      • Soumya's avatar
        Soumya
        Occasional Contributor

        Hi,

         

        I have attached a snapshot where I have given wait of 60000ms. Inspite of that the test  case fails because it doesn't wait for 1 minute for the button to get enabled

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      The fix is... there is no fix... Auto-Wait Timeout only has to do with whether or not an object exists... visibility, enabled, disabled, etc., are not controlled by Auto-Wait Timeout.  To do those, as you linked, you need to do "WaitProperty" type calls and other similar checks to determine other properties of objects.