Due to a design problem of TestComplete Exists method does not provide additional overload of maxtimeout millisecond parameter and it does wait until time specified in Project Properties > Auto-Wait Timeout, which makes the situation worse. I want to know if it is somehow possible to adjust this implicit timeout property though code.
I am really pissed off with SmartBear's attitude of rejecting a great suggestion which help everyone "just to add just another overload in the existing Exists function, which will start accepting the timeout" and overloads does not impact existing signature.
Please do not suggest me to use WaitNNN, its a most stupid API design I have ever seen.
I'm not sureif I understand.Butwhen you want toexpect somethingyou can useas well.Addinga variableto controlthe maximumtime.
vartime: integer; while not(Sys.Waitprocess('Doro').Exists) of begin time:time+=500; Delay(500); if (time= 10000) then Log.error('Error'); end; end;
When you want towaitother objectsetc.You changeonlywhiletheconditionfor example.
Anotherthing that can help, it wouldfor example.Asevery time theTestCompletedoes not findthe object (mapping)it calls theTIMEOUTtime.Not to callyouwill:
vartime: integer; begin
time := 0; Options.Run.Timeout: =0; while not(Sys.Waitprocess('Doro').Exists) of begin time :=time+500; Delay(500); if (time= 10000) then Log.error('Error'); end; end; //After waitingyouexpectyou assignthe value ofnomaltimeout Options.Run.Timeout: =10000;
Thanks for awesome replies, this is what I was looking,
Options.Run.Timeout = 30000;
Similarly we control implicit timeout in selenium.
I have now come up with 2 functions based on the above solution.
WaitForExists(expectedObject, MaxTimeOutInSec) 'usual wait
WaitTillExists(currentObject, MaxTimeOutInSec) 'this would be used when we are expecting some popup window should hide after doing some action, but it is taking long time
I've also got a solution for this task, see attachment.
I'm sorry, it is written in german language.
It is a class in a script extension, and it is used as follows:
' set Your timeout
Set Timeout = PVA_0.TC.SetRuntimeoutObj(projectsuite.Variables.WaitExMs, mcModul & cRoutine)
[object var ] [script [new timeout in ms] [name of originator ]
extension namespace, module, routine]
' reset to previous timeout
It comes with some advantages:
- it can be used hierarchically in subroutines
- Timeout is also reset automatically as soon as the object variable is destroyed after the defining routine is left.
- it comes with a threshold (german: "Schwelle") for reduction: only if the reduction is more than a certain factor, it is executed. This is for performance issues, as on my pc, changing the auto-wait timeout requires 4 ms of time
- the routine name of the originator is comprised for debugging purposes
The code is meant to be located in a script extension, so some global Objects have to be handed in when the test is started: