Forum Discussion

joeychou99's avatar
joeychou99
Regular Visitor
4 years ago
Solved

TestComplete Verifying long wait time

I'm currently trying to verify a visual prompt reminder kinda like an icon showing up every hour. Normal I would just do a WaitProperty attaching isVisible, but I think waiting an hour pretty absurd. I was wondering if there is something like a passive wait where when testcomplete reaches a certain time it will pause it's current tests to finish verifying. I know exactly when the icon should show up. I could possibly run other test in between, but I'm cautious about timing.  Any suggestions?

  • Hi,

     

    I suggest You write an interval function for these actions:

    use Timer object:

     

    Example:

     

     

    // unit name 'Example1'
    function run() {
      MyTimer = Utils.Timers.Add(3000, "Example1.timerRoutine", true);
    }
    
    function timerRoutine() {
      Indicator.PushText("FROM TIMER!")
    }
    
    // unit name 'Example2'
    //USEUNIT Example1
    function runTimer() {
      Example1.run();  
    
      for(y = 1; y < 1000000; y++) {
        Indicator.PushText("waiting for timer!")
      }
    
    }

     

     

    If You run this function, you can see that every 3s indicator will switch text from "waiting for timer!" to "FROM TIMER!"

    Write Your own function to look for that popUp every 1h. But be careful.

     

     

    When a timer elapses, TestComplete pauses the test to run the timer’s routine. The test is resumed after the timer routine has finished running.

    Because of this, try to make timer routines as fast as possible. Using many timers with long-running routines can slow down the test run.

     

3 Replies

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi,

     

    I suggest You write an interval function for these actions:

    use Timer object:

     

    Example:

     

     

    // unit name 'Example1'
    function run() {
      MyTimer = Utils.Timers.Add(3000, "Example1.timerRoutine", true);
    }
    
    function timerRoutine() {
      Indicator.PushText("FROM TIMER!")
    }
    
    // unit name 'Example2'
    //USEUNIT Example1
    function runTimer() {
      Example1.run();  
    
      for(y = 1; y < 1000000; y++) {
        Indicator.PushText("waiting for timer!")
      }
    
    }

     

     

    If You run this function, you can see that every 3s indicator will switch text from "waiting for timer!" to "FROM TIMER!"

    Write Your own function to look for that popUp every 1h. But be careful.

     

     

    When a timer elapses, TestComplete pauses the test to run the timer’s routine. The test is resumed after the timer routine has finished running.

    Because of this, try to make timer routines as fast as possible. Using many timers with long-running routines can slow down the test run.