Forum Discussion

stega's avatar
stega
Contributor
11 years ago

Test actions time

Hi All,

I want to get the time of each actions i make in the automated test. For example when i click on a button, how much does it take to reload the page, or a pop-up window appears. Is there a function for it. I want to write it to the log.

Thanks.
  • Hello Gabor,



    you could use a loop with a delay to check certain attributes/values/state of an object.

    Sth. like this for existence of an object -> each loop is delaying the execution for 100 miliseconds, and the variable pageLoadingTime would give you the number of iterations before test object is recoginzed as existing:





    var pageLoadingTime = 0;

      do

      {

        aqUtils.Delay(100);

        pageLoadingTime += 1;

        obj = objBrowser.myPage;

      }

      while (!obj.Exists)





    Regards,



    Marin
  • And i found another solution for this:




    startTime = GetTickCount();


      do


      {


        ...


      }


      while ();


      loadTime = GetTickCount() - startTime;

  • marin's avatar
    marin
    Frequent Contributor
    Hello Gabor,



    you could use a loop with a delay to check certain attributes/values/state of an object.

    Sth. like this for existence of an object -> each loop is delaying the execution for 100 miliseconds, and the variable pageLoadingTime would give you the number of iterations before test object is recoginzed as existing:





    var pageLoadingTime = 0;

      do

      {

        aqUtils.Delay(100);

        pageLoadingTime += 1;

        obj = objBrowser.myPage;

      }

      while (!obj.Exists)





    Regards,



    Marin
  • marin's avatar
    marin
    Frequent Contributor
    Hello Gabor,



    excellent...

    Glad that I could point you in the right direction.



    Regards,



    Marin
  • When i want to insert some error handling, what should i do?

    If an event can not be done, the timing won't run, and nothing will be in the log.

    So, i want to do that if an error occurs, for example a page can not be loaded, the script runs forward, and the time measure writes to the log that the time limit exceeded.

    Should i do a try-catch block, or something?

    Thanks.