Ask a Question

Adding delay to keyword test - not based on object visible

SOLVED
Logiv
Contributor

Adding delay to keyword test - not based on object visible

Hello,

I am trying to add a delay in a keyword test. There is no new window or object that appear during my test, but my program has an internal process that takes a few second to execute. I cannot test for Object visible Wait Property since there is no new object. 

How can I achieve a delay without testing for an object? 

Thanks!

8 REPLIES 8
AlexKaras
Champion Level 3

Hi,

 

Miscellaneous Category contains Delay operaton. Does it help?

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

You can add a Delay for some fixed length of time this way: 

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/misc/delay.html

 

If you were running this test manually, how would you know if the internal process had stopped or not?

tristaanogre
Esteemed Contributor

While you can add a physical delay, I'd still aim towards finding something more dynamic.  

 

So, this internal process.  What does it do?  Does it update an SQL table? Create a file? etc?  As @Marsha_R suggested, if you were doing this manually, how would you know the internal process is complete?  Would you click on something, check a value, and then wait and repeat the process?

 

The reason why I'd not do a physical delay is two-fold:

 

1) The process may take LESS time on some iterations through the test than you have the delay set for which would mean that you would have an automation process sitting doing nothing for a time when it could be continuing the process.

2) The process may take MORE time on some iterations through the test than you have the delay set for which would mean that you could end up with an invalid test because you didn't wait long enough.

 

So, finding a dynamic way to check the process and determine if it's complete will minimize the idle time of your process while allowing for long potential delays by setting a maximum timeout.


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

Thank you Alex, it worked great. I just started using TestComplete and I am learning 🙂

Hello Robert,

 

I understand what you are saying and I wanted to avoid "empty" delays, I know they are not the best.

In this case, nothing changes in SQL. Nothing changes on screen either. No variable is populated. I am testing a Point Of Sale software and after a sale, we revert back to the "initial" menu (if it was changed). In my case, the menu/screen was not changing in this specific test.

 

I need to test the transaction total after I hit the Cashout button, but since the process is trying to set back the menus to default, when I check the total immediatly it is empty. And the total is not shown as a field, we "draw" it on a generic form, there is only one object name and it doesn't change once the total is populated. 

I don't know if I explained it well, but I do understand your statement!  We might rewrite parts of our application to be more Automation-friendly over time, because as it is right now, it is not always easy. We have forms that use a dynamic number, each time the software is launched, it'll receive a different form number - it was not hardcoded when it was build. So it is hard for me to even verify if an object is active.

 

Thanks for the help!

Hello Marsha,

 

We cannot run into this problem manually, or at least I was not able to. The process takes 65 milliseconds.

Well, in fact if I do transactions really fast, I can sort of hit the issue but it is hidden since I am not asking to get the total of the last transaction. The functions are "queued" and executed when the software is free. I am not too sure if I could test this within TestComplete.

I am not a programmer, nor do I have access to the source code, so my means are somehow limitted right now 😞

Thanks for the insight.  

tristaanogre
Esteemed Contributor

@Logiv Having worked with a POS application myself in the past, when a transaction is completed, there HAS to be some data stored somewhere. 🙂  We had a journal that logged every transaction in detail that was "pushed" to SQL on a regular trigger.  So, for us, when I was automating that application, after we'd complete the transaction, we'd check the SQL journal to see that the transaction pushed before we moved on.  This was actually necessary in our test because at the end of the transaction we wanted to ensure that the data in SQL matched the transaction we tested (payment totals, item totals, tax totals) as we had discrepencies in the past between what was journaled and what the actual transaction was.

So, for your situation, there has to be some data stored somewhere at the end of the transaction that can be checked to indicate that the transaction has been completed.  That's what I'd look for, even if it's an internal value that's not visible on screen.  

 

Just my $0.02. 🙂


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
Marsha_R
Champion Level 3

cancel
Showing results for 
Search instead for 
Did you mean: