[Webtest] Unexpected error when invoking large xml file

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Fri, 29 Aug 2008 09:58:28 +0200


Hi,

currently HtmlUnit loads systematically the server response in memory
which may cause problem for very large responses when you don't run your
WebTest with enough memory allocated.

It would surely be possible to enhance HtmlUnit to use a file system
based cache... but until now nobody was interested enough to contribute
a patch.

Btw: in your case, it would be probably more effective to nest your
dataDriven within your webtest when you always work on the same
response. The produced reports won't be so nice, but with a huge file,
it may save a lot of time.

Cheers,
Marc.
-- 
Blog: http://mguillem.wordpress.com


Tokutan wrote:
> Hi,
> 
> I am experiencing unexpected error when invoking a large xml file (about
> 30 mb). Here is the script:
> 
>     <dataDriven tableContainer="testsip.xls" table="true">
>        
>        
>         <webtest name="verify node ${check1} ">
>        
>         <config haltonerror="false" haltonfailure="false"
> autorefresh="true" protocol="file"
>         basepath="C:\webtest5\myWebTestProject\tests\">
>          <option name="ThrowExceptionOnScriptError"
>         value="false"
>         />
>               <option name="ThrowExceptionOnFailingStatusCode"
>         value="false"
>         />
> 
>      </config>
>    
>    
> <invoke url="careershays20080825123203.xml" description="invoke file }" />
> 
> <not description="check no element in list  found element: ${check1}">
> <verifyText text="(?i:${check1})" regex="true" 
> description="check1smallcase${check1} "/>
> 
> </not>
> 
> </webtest>
> </dataDriven>
> </target>
> </project>
> 
> I got the following error:
> 
> Unexpected exception caught: org.apache.tools.ant.BuildException
> 
> C:\webtest5\myWebTestProject\tests\testsip.xml:25: java.lang.OutOfMemoryError: Java heap space
> 
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
> 
> 	at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
> 	at com.canoo.webtest.steps.Step.execute(Step.java:101)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
> 
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> 
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> 
> 	at org.apache.tools.ant.Task.perform(Task.java:348)
> 	at org.apache.tools.ant.Target.execute(Target.java:357)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:385)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> 
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> 	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> 
> 	at org.apache.tools.ant.Main.runBuild(Main.java:698)
> 	at org.apache.tools.ant.Main.startAnt(Main.java:199)
> 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> 	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> 
> 
> The script failed at invoking the file. When invoking smaller xml file
> it is ok. Is there anyway I can overcome this problem?
> 
> 
> Thanks.