cancel
Showing results for 
Search instead for 
Did you mean: 

How does TC parse script lines?

SOLVED
Contributor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: How does TC parse script lines?

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?


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

7 REPLIES 7
Community Hero

Re: How does TC parse script lines?

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.

Contributor

Re: How does TC parse script lines?

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?

Community Hero

Re: How does TC parse script lines?

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.

Contributor

Re: How does TC parse script lines?

Sorry, should've clarified further.

The action before hand would simply be pressing a button (e.g. Aliases.Program.BeginAction.ClickButton()) or something similar. That action would begin a process that takes time (e.g. the button is to compile and export a spreadhsheet).

 

It should pass through that line without a failure, but it has a chance of causing the windows application to stall. You might be familiar, it takes up the whole screen and sets cursor to loading. Clicking on the application brings up the dialogue of unexpected issue "Wait for program to respond" or "End process" but you can simply wait for it to execute and it'll go back to normal.

 

If you need more clarification please let me know Smiley Happy

Community Hero

Re: How does TC parse script lines?

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?


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

Contributor

Re: How does TC parse script lines?

Not exactly, but I think you inadvertantly answered my question.

After clicking the button, you're able to move on - so it simply waits for the next object to be called (next line of code). I don't want to change how the program itself waits, so instead I'll be trying something like this:

 

benchmarks = []
# - Begin intensive process - benchmarks.append(addBenchmark())
while True:
if -WaitWindow that should be clickable after done loading-:
break
else:
benchmarks(append(addBenchmark())
compileBenchmarks(benchmarks)

 So thank you for confirming it is possible, I'll get to it.

Community Hero

Re: How does TC parse script lines?

Hi,

 

If you are working with the desktop application then you may consider AQtime profiling tool (https://smartbear.com/product/aqtime-pro/overview/). It will provide you not with just a figure of how long did it take to complete intensive process, but also with the detailed timing breakdown.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video:
Top Kudoed Authors