Dear all,
 
I am a novice in writing JWebUnit testcases. I am using JWebUnit1.4 RC1 
release. 

When I tried to run a simple testcase, it has resulted in the following 
exception.
 
Could any one of you help me in giving the reason for the following exception 
and to solve it??
 
 
java.lang.RuntimeException: Refresh Aborted by HtmlUnit: Attempted to refresh a 
page using an ImmediateRefreshHandler which could have caused an 
OutOfMemoryError Please use WaitingRefreshHandler or ThreadedRefreshHandler 
instead.
 at 
com.gargoylesoftware.htmlunit.ImmediateRefreshHandler.handleRefresh(ImmediateRefreshHandler.java:77)
 at 
com.gargoylesoftware.htmlunit.html.HtmlPage.executeRefreshIfNeeded(HtmlPage.java:1060)
 at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:146)
 at 
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:440)
 at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:335)
 at 
com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPageIfPossible(BaseFrame.java:129)
 at 
com.gargoylesoftware.htmlunit.html.BaseFrame.loadInnerPage(BaseFrame.java:114)
 at com.gargoylesoftware.htmlunit.html.HtmlPage.loadFrames(HtmlPage.java:1419)
 at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:143)
 at 
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:440)
 at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:335)
 at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:362)
 at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:217)
 at 
com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickAction(HtmlImageInput.java:133)
 at 
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:114)
 at 
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:156)
 at 
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:117)
 at 
net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.submit(HtmlUnitDialog.java:1251)
 at net.sourceforge.jwebunit.junit.WebTester.submit(WebTester.java:1789)
 at net.sourceforge.jwebunit.junit.WebTestCase.submit(WebTestCase.java:1372)
 at TransactionWebUnit.loginAs(TransactionWebUnit.java:63)
 at TransactionWebUnit.testValidLogin(TransactionWebUnit.java:54)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at net.sourceforge.jwebunit.junit.WebTestCase.runBare(WebTestCase.java:47)
 at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
 
 
What should I do if I don't want to refresh anything?
 

Program:
public class TransactionWebUnit
        extends WebTestCase
{
    private static final String VALID_UID = "root";
    private static final String VALID_PWD = "pramati1";

    public TransactionWebUnit(String name)
    {
        super(name);
    }

    public void setUp() throws Exception
    {
        getTestContext().setBaseUrl("http://localhost:8181/admin";);
    }

    public void tearDown() throws Exception
    {
    }

    public void testInitialState()
    {
        beginAt("/");
        assertFormElementPresent("j_username");
        assertFormElementPresent("j_password");
        assertSubmitButtonNotPresent("submit");
    }

    public void testValidLogin()
    {
        loginAs(VALID_UID, VALID_PWD);
        assertTitleEquals("Pramati Server Management Console");
    }

    private void loginAs(String user, String pass)
    {
        beginAt("/");
        setFormElement("j_username", user);
        setFormElement("j_password", pass);
        submit();
    }

    public void testTransactionTimeOut()
    {
        loginAs(VALID_UID, VALID_PWD);
        gotoPage("server/transaction/edit.jsp");
        setFormElement("TimeOut", "610");
        submit();
        gotoPage("com/pramati/admin/webview/ShowStatusServlet");
    }

    public static void main(String[] args)
    {
        TestSuite testSuite=new TestSuite();
        testSuite.addTest(new TransactionWebUnit("TransactionWebUnit"));
        junit.textui.TestRunner.run(testSuite);
    }
}


 
Thanks and Regards
Chaitanya
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to