[Webtest] [webtest][JIRA] Created: (WT-333) change config's autorefresh semantic to allow to specify a threshold

Mart Toom (JIRA) Mart Toom (JIRA)" <noreply@canoo.com
Fri, 5 Oct 2007 12:13:58 +0200 (CEST)


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

         Key: WT-333
         URL: http://webtest-community.canoo.com/jira/browse/WT-333
     Project: WebTest
        Type: New Feature

    Versions: 2.5    
    Reporter: Mart Toom


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>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira