Forum Discussion

AndrewCast's avatar
AndrewCast
Contributor
6 years ago
Solved

How does TC parse script lines?

Attempting to add benchmarking scores after running intensive functions from the tested application.

 

I would like to do it as such:

 

benchmarks = []
# Begin intensive process for i in range(0, 5): benchmarks.append(addBenchmark()) time.sleep(1)
compileBenchmark()

What this will do is start something that should take some time to finish, then take five different measurements across five seconds and average them out to get the stats (e.g. time, cpu usage, memory usage, etc).

My question is, I notice that TC sometimes waits for something when it takes a while. While it does so, will it be stuck in 

 

# Begin intensive process

 

Or will it enter my loop and start recording?

 

Also, has anyone tried out benchmarking and how did you go about it? I'm currently using psutil.

  • We have a web application that does something similar... click on a button and you get an overlay object that indicates "Loading..." that, until that goes away, the automation needs to wait.  WE built a custom routine that simply checks for that object to be visible... if it is, sleep for 500 ms... loop until that object is no longer visible.  

     

    Is that what you're looking for?

7 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Depends on how you handle the waiting.  If TC times out without any other instructions, it will stop.  If you handle this in your code, then you can describe the conditions for moving on to your loop if that's what you want.

    • AndrewCast's avatar
      AndrewCast
      Contributor

      I'd like to avoid it timing out, and instead of it waiting on anything it simply goes off to my loop.

      If you say TC times out in this case, does this mean TC parses lines in a way that makes it impossible to enter the loop without the previous line completing?

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Hard to know how to advise you without seeing the code.  Yes, TC executes the script lines sequentially.  It has no way to know how to continue otherwise unless you tell it.  It will try to complete each line and then move on if it can.  If it can't, it will stop and tell you.

         

        What is in your code that it is waiting on?  There may be a simple way around this but making us guess at it is just going to frustrate everyone.