Page 1 of 1

unexpected delay from user code (data driven test)

Posted: Thu May 07, 2015 1:04 am
by c676228
try {
Validate.NotExists(repo.ItemInfo);
}
catch {
//do some cleanup
return;
}

//repo.Container.Element is displayed within less than a second, however, the data is not entered until about //1.5 or 2 min later
Report.Log(ReportLevel.Info, "Wait", "Waiting 10s for item 'repo.Container.Element' to exist.", repo.Container.Element, new ActionTimeout(10000));
Container.Element.WaitForExists(10000); //or ensurevisible()
//enter data from excel sheet to repo.Container.Element delayed about 2 min.
Any idea?

Thanks,
Betty

Re: unexpected delay from user code (data driven test)

Posted: Thu May 07, 2015 7:04 am
by odklizec
Hi,

It's hard to say what's wrong without more details about your SUT (Ranorex Snapshot), xpath behind the delayed element, exact code you are using to enter the data to repo element, Ranorex version, etc. Could you please provide these details?

There was a problem in 5.3.0 and 5.3.1 with slowdown while entering data to HTML elements. This has been fixed in 5.3.2. Another reason could be too general xpath with a lot of optional (?) elements or searching through all descendants (//). Again, it's hard to say without more details.

Re: unexpected delay from user code (data driven test)

Posted: Thu May 07, 2015 8:15 pm
by c676228
Hi odklizec,

I take a closer look. It seems that it is not xpath related.
When using Firefox or Chrome
At the right hand corner of the progression window, the searching for repo.ItemInfo ... text displayed
for statement Validate.NotExists(repo.ItemInfo) is not executed until about 2 min later. There is no delay or wait for action in the recording module before calling this usercodemethod. So this is very odd. IE just frequently stalls here.

public void usercodemthed()
{
try {
// unexpected delay before execute this statement, it just display wait for 200ms in the progress window, actual wait time is about 2 //min.
Validate.NotExists(repo.ItemInfo);
}
...

}

Re: unexpected delay from user code (data driven test)

Posted: Thu May 07, 2015 8:46 pm
by krstcs
Something to understand about the 'Validate.NotExists()' method: Ranorex will try to find the item for the full 'effective' timeout of the item before it returns from that function. If your item's effective timeout is 2 min, for example, then Ranorex will try to find the element for the full 2 min before it returns.

If the element IS NOT FOUND in that time-frame, then the method PASSES.

If the element IS FOUND, then the method returns immediately and FAILS.


In your case though, it should still show the timer-bar, so this may not be the issue.


If you want to check if something exists but want a shorter time-out, you can use the Exists(Duration) method in an if() block and pass the desired timeout duration.

Re: unexpected delay from user code (data driven test)

Posted: Fri May 08, 2015 8:21 pm
by c676228
Hi krstcs,

Now I am using the following method, the timing seems a bit more controllable
Validate.NotExists(emailDuplicateError.AbsolutePath, new Duration(15000))

The method seems to be called at the expected time. There is no more 1.5-2 min delay before this method call.
This seems to be a side benefit for using this method. I don't know why.