History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: WT-333
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Assignee: Marc Guillemot
Reporter: Mart Toom
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
WebTest

change config's autorefresh semantic to allow to specify a threshold

Created: 05/Oct/07 12:13:34   Updated: 23/Jan/08 13:32:39
Affects Version/s: 2.5
Fix Version/s: 2.6


 Description   
The problem

System under test has right after login a page that contains several frames and in one frame there is a refresh going that fetches some info from server.
As this frame is ever refreshing then the page gives error notification when ImmediateRefreshHandler is in use. The notification looks like following:

Refresh Aborted by HtmlUnit: Attempted to refresh a page using an ImmediateRefreshHandler which could have caused an OutOfMemoryError Please use WaitingRefreshHandler or ThreadedRefreshHandler instead.

This can be avoided when to set in <config> tag autorefresh to "false". But there is need for refreshing later during the test.

Solution provided by Marc:

I'm thinking on a solution to change config's
autorefresh semantic to allow to specify a threshold: refresh with time
below the specified value would be executed immediately and refresh with
time larger than the specified value would be discarded. In you case
something like autorefresh="10" would discard the refresh for
/sample/RMAlerts (refresh interval is in this file 15 sec)

Temporary workaround suggested by Marc

<groovy>
import com.gargoylesoftware.htmlunit.*

class MyRefreshHandler extends ImmediateRefreshHandler
{
  public void handleRefresh(final Page page, final URL url, final int
seconds) throws IOException
  {
    if (seconds < 10)
      super.handleRefresh(page, url, seconds)
    else
    {
      println "Dismissed refresh to $url with $seconds seconds delay"
    }
  }
}
step.context.webClient.refreshHandler = new MyRefreshHandler()
</groovy>

 All   Comments   Change History      Sort Order:
Comment by Marc Guillemot [23/Jan/08 13:32:39]
Implemented in build 1653.