cancel
Showing results for 
Search instead for 
Did you mean: 

How does TC parse script lines?

SOLVED
Highlighted
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
Highlighted
Community Hero

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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available

View solution in original post

7 REPLIES 7
Highlighted
Community Hero

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.

Highlighted
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?

Highlighted
Community Hero

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.

Highlighted
Contributor

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 🙂

Highlighted
Community Hero

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
[Hall of Fame]
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
Vegas Thrill Rider
Extensions available

View solution in original post

Highlighted
Contributor

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.

Highlighted
Community Hero

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 Hero]
____
[Community Heroes] 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. Posts made by [Community Heroes]
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.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!
Top Kudoed Authors