I've recently upgraded from build574 to build1108.  I had to pull the
latest CVS fro htmlunit to get Prototype (the JavaScript library)
support.  Now I'm experiencing a strange issue with some JSF pages I'm
testing.  Basically, webtest just hangs when it gets to the page, and
then runs out of memory.

EditUser:
  [webtest] 2006-01-11 10:00:12,867 ERROR com.canoo.webtest.steps.Step - Canno
handle unexpected exception in step ClickLink at C:\Source\appfuse-jsf\test\we
web-tests.xml:74:  with (label="Edit Profile", description="click Edit Profile
ink", stepType="clicklink")
  [webtest] java.lang.OutOfMemoryError: Java heap space

BUILD FAILED
C:\Source\appfuse-jsf\build.xml:533: The following error occurred while execut
g this line:
C:\Source\appfuse-jsf\test\web\web-tests.xml:70: Test failed.
Exception raised: com.canoo.webtest.engine.StepExecutionException: Unexpected
ception caught: java.lang.OutOfMemoryError: Java heap space, Step: ClickLink a
C:\Source\appfuse-jsf\test\web\web-tests.xml:74:  with (label="Edit Profile",
scription="click Edit Profile link", stepType="clicklink")com.canoo.webtest.en
ne.StepExecutionException: Unexpected exception caught: java.lang.OutOfMemoryE
or: Java heap space, Step: ClickLink at C:\Source\appfuse-jsf\test\web\web-tes
.xml:74:  with (label="Edit Profile", description="click Edit Profile link", s
pType="clicklink")
        at com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:56

        at com.canoo.webtest.steps.AbstractBrowserAction.handleUnexpectedExcep
on(AbstractBrowserAction.java:106)
        at com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHe
er.java:108)
        at com.canoo.webtest.steps.request.AbstractTargetAction.gotoTarget(Abs
actTargetAction.java:106)
        at com.canoo.webtest.steps.request.AbstractTargetAction.doExecute(Abst
ctTargetAction.java:78)
        at com.canoo.webtest.steps.Step.execute(Step.java:143)
        at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:28)
        at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:79)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(Sing
CheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultE
cutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


Total time: 1 minute 1 second
$

Here's my test:

    <!-- Verify the edit user screen displays without errors -->
    <target name="EditUser"
        description="Tests selecting the 'Edit Profile' forward">
        <webtest name="editUser">
            &config;
            <steps>
                &login;
                <clicklink description="click Edit Profile link"
label="${menu.user}"/>
                <verifytitle description="we should see the user profile title"
                    text="${webapp.prefix}${userProfile.title}"/>
            </steps>
        </webtest>
    </target>

Pretty simple stuff.  If I remove verifyTitle, it still happens. 
Unfortunately, since I'm using JSF, I have no control over the
JavaScript that's generated from the following:

<h:commandLink value="#{text['menu.user']}" action="#{userForm.edit}"/>

I noticed this error on another page too, but changing the JavaScript
fixed the problem:

 <script type="text/javascript">
-    var f = document.forms['passwordForm'];
-    f.elements['passwordForm:_link_hidden_'].value='passwordForm:execute';
-    f.elements['username'].value='<c:out value="${param.username}"/>';
-    f.submit();
+    function submitForm() {
+        var f = document.forms['passwordForm'];
+        f.elements['passwordForm:_link_hidden_'].value='passwordForm:execute';
+        f.elements['username'].value='<c:out value="${param.username}"/>';
+        f.submit();
+    }
+    window.onload=submitForm;
 </script>

Here's the generated JavaScript - which used to work fine with
build574 and JavaScript enabled.

<ul class="glassList">
    <li>

        <a href="#"
onclick="clear_editUser();document.forms['editUser'].elements['editUser:_link_hidden_'].value='editUser:_id0';if(document.forms['editUser'].onsubmit){document.forms['editUser'].onsubmit();}document.forms['editUser'].submit();return
false;" id="editUser:_id0">Edit Profile</a>
    </li>
    <li>
        <a href="/appfuse-jsf/selectFile.html">Upload A File</a>
    </li>
</ul>

<input type="hidden" name="editUser_SUBMIT" value="1"/><input
type="hidden" name="editUser:_link_hidden_"/><script
type="text/javascript"><!--
function clear_editUser() {
  var f = document.forms['editUser'];
  f.elements['editUser:_link_hidden_'].value='';
  f.target='';
}
clear_editUser();
--></script>

Thanks,

Matt
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to