Forum Discussion

kaivi's avatar
kaivi
Contributor
6 years ago

check aqPerfomance

Hi,

 

is there any way to check if the aqPerfomance method is already running?

 

regards

Kai

  • Hi,

     

    > This is a recursive call from OnLogError that is stopped by TestComplete.

    A possible way to prevent this is to introduce a global or Project variable (I think that the latter is better) and use it as a flag. Like this:

    -- Name the variable as, say, bInErrorHandler and set it to false by default;

    -- The OnLogError function may look like this:

    function OnLogError(...)
    {
      if (bInErrorHandler)
        return;
      bInErrorHandler = true;
    
    ... // main handler's code
    
      bInErrorHandler = false;
    }
    

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The methods of the aqPerformance object aren't actually "running" per say... they are more markers that store values.  You "Start" a counter which logs a time stamp... then you "Check" the counter against the current time... or you get the "Value" of a counter...  So, it's not exactly "running" per se.

    What are you trying to achieve?

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Kai,

     

    No way if I got your question right. But you may suppress warning in the log with the help of the WarnIfExist parameter.

     

    • kaivi's avatar
      kaivi
      Contributor

      Hi,


      thank you both for your answer. I have added the OnLogError feature to our tests. So every error is recorded here. Normally I start the aqPerfomance Default at the beginning of a keyword test and when the keyword test generates an error, it jumps to the OnLogError and stops, checks and evaluates the aqPerfomance. But if I start a selected operation in the middle of a keyword test just to check if e.g. a change is correct, it jumps to OnLogError if an error occurs and starts another error because the aqPermonce is not started yet. This is a recursive call from OnLogError that is stopped by TestComplete. The motivation behind this is to write the aqPErfomance value to a DB.

      I hope you know what im trying to do.

      For now, I think I'll try it with "try" and "catch" of an exception. Or with the WarnIfExists I didn't know about it before, so I investigate it.

       

      regards

       

      Kai

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > This is a recursive call from OnLogError that is stopped by TestComplete.

        A possible way to prevent this is to introduce a global or Project variable (I think that the latter is better) and use it as a flag. Like this:

        -- Name the variable as, say, bInErrorHandler and set it to false by default;

        -- The OnLogError function may look like this:

        function OnLogError(...)
        {
          if (bInErrorHandler)
            return;
          bInErrorHandler = true;
        
        ... // main handler's code
        
          bInErrorHandler = false;
        }