Inconsistant timing for how long till a img appers

Below is a snippet of a basic script I created. The intent was to time how long it takes from the right click till a image appears on the screen. Running this manually at the SUT it takes about a second. Using Eggplant I have gotten results that range from 2.2 seconds to 4.0 seconds. Out of roughly 30 runs it has returned the expected 1 second timing twice. Any ideas? I have made the image being searched for only a few pixels large. The SUT has RealVNC installed and both RealVNC and Eggplant have the preferences defaulted to out of the box settings.

setoption searchrectangle, ((5,180,70,230))
put the time into StartTime
RightClick "friendly symbol"
setoption searchrectangle, ((190,160,275,225))
WaitFor 10, "friendly_on_cursit"

put the time - StartTime into TotalTime

Thanks,
Adam

In addition to network latencies, which cannot be ignored, there are a number of things that factor into how long it takes to find an image. By default, Eggplant is designed to give the SUT time to respond, so it has some built-in pauses that keep it from timing out needlessly on common interface events. One of the first things to note is the RemoteWorkInterval, which is the built-in pause between actions sent to the remote system; it is .7 seconds by default. There is also a pause between searches of the screen if the image is not found on the first pass. These can be reduced via code:


set the remoteWorkInterval to .1
set the imageSearchDelay to .05

but note that without these delays, Eggplant is much more likely to fail to find an image, so they should be set back to their defaults when you are not trying to precisely time events.

The number of possible matches that Eggplant finds will also affect how long the search takes, so finding a blue dot on a field of white will happen more quickly than finding a particular text string on a page of text. Reducing the tolerance of the image will reduce the number of possible matches and could speed up the search in some situations. And making the image tiny probably is not helping – that’s just going to increase the number of possible tilings in your search area that could hold the image.

Adam:

In your particular test here you also are setting the timer a little earlier than you really want. You start it before you have even clicked on “friendly symbol” so your timer includes the time to search for and find that image (as well as any preceding time as part of the RemoteWorkInterval as described above). Starting it right AFTER the action in the script won’t be more than a few milliseconds (and probably will record a time about when the actual remote machine has received the event.

So this chunk should give you much more reliable and accurate timing

setoption searchrectangle, ((5,180,70,230)) 
RightClick "friendly symbol" 

put the time into StartTime 
set the remoteWorkInterval to .1 
set the imageSearchDelay to .05
setoption searchrectangle, ((190,160,275,225)) 
WaitFor 10, "friendly_on_cursit" 
put the time - StartTime into TotalTime 

You might also want to make sure you are on a fast local connection (wired is better than wireless as well for lower latency).

Thanks guys. I’ve been pulled onto some other tasking for the time being so I can’t give this a try. I should be back on it soon and will let you know how things go.

Thanks again,
Adam

I’ve gotten it to the point that the results are pretty consistent. The system settings help and I also decreased my search rectangle as I was picking up some non essential bits.

Thanks guys.