[Webtest] Re: Memory Leak in Canoo

Rob Manthey Rob Manthey <canoo@rob.manthey.id.au>
Tue, 05 Dec 2006 15:41:02 +1000


This is a multi-part message in MIME format.
--------------060906060409030806080106
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Sorry, I think you may have already answered my question with this ...

    THEN, each target in a WebTest XML file checks that the doSetup was
    already run using Ant's depends attribute, like this:
    	<target name="Test No6" depends="doSetUp">

Does ant's "depends" automatically ensure that doSetUp is only run once 
no matter how many times it is called in a sequence of targets?  Why 
then do you set a property of  <property name="alreadySetUp" 
value="true"/> ?

RM

on 05/12/06 14:30 Nate Oster said the following:
> You can get around the limitation mentioned by George Bills, below, if
> you include a standard setup file in each WebTest.  I don't think the
> "ifStep" proposed earlier will work, since ifStep is itself a WebTest
> step, not a native Ant task.
>
> We use a common file called "WebTestSetup.xml"
> It has one target, "doSetup", which declares the WebTest taskdef.
> The last line in the doSetup target is:
> 	<property name="alreadySetUp" value="true"/>
>
> Each WebTest XML file includes WebTestSetup.xml BEFORE any <webtest>
> tags like this:
>  	<import file="[your path here]/WebTestSetup.xml"/>  
> THEN, each target in a WebTest XML file checks that the doSetup was
> already run using Ant's depends attribute, like this:
> 	<target name="Test No6" depends="doSetUp">
>
> As a result, you can run any of our WebTests from a command line, or
> include it in an <antcall> suite.  No matter what, the Taskdef only gets
> called ONCE.  
>
> Cheers!
> Nate Oster
>
> Date: Tue, 05 Dec 2006 13:54:31 +1100
> From: George Bills <gbills@funnelback.com>
> To: webtest@lists.canoo.com
> Subject: Re: [Webtest] Re: Memory Leak in Canoo
> Reply-To: webtest@lists.canoo.com
> Reply-To: George Bills <gbills@funnelback.com>
>
> I'm not sure if this is what you want, but you can pass properties from 
> Ant script to Ant script - most ways of calling an Ant script pass 
> properties from the parent to the child by default, and you can use 
> "inheritall='true'" otherwise. I load "webtest.xml" once to define all 
> the webtest stuff in my Ant test harness, and then that test harness 
> calls the tests. The tests themselves don't need to include the webtest 
> stuff at all - but that means that you can't run the tests individually 
> (because they'll be missing the webtest definitions). Hope that helps.
>
> Rob Manthey wrote:
> > (I'll probably be corrected shortly, but I think this is what Marc is 
> > getting at ...)
> >
> > This line (may have been slightly modified by me for my local 
> > conditions) must appear somewhere for webtest to work:
> >  <taskdef file="${canoowebtest.home}/webtestTaskdefs.properties"/>
> >
> > Anyway, each time it is included it instantiates a bunch of resources 
> > from the sounds of it and so it should only be run once per set of 
> > tests.  I guess this means wrapping it in some sort of conditional, 
> > but I have at the top of each file, so that's why (?) I accumulate 
> > memory usage when I hit "ant all" as the jvm is created once per ant 
> > session, but the webtest taskdef is called for every file.
> >
> > What is the optimal way to have the taskdef declared for each file, 
> > but so that it only gets called once if that file is referenced by 
> > wrapper files?   Such as:
> >
> >    <ifStep description="Run Taskdef Once" 
> > unless="${taskdefLoaded}=='true'">
> >        <taskdef
> file="${canoowebtest.home}/webtestTaskdefs.properties"/>
> >        <property name="taskdefLoaded" value="true" />
> >    </ifStep>
>
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>   

--------------060906060409030806080106
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sorry, I think you may have already answered my question with this ...<br>
<blockquote>
  <pre wrap="">THEN, each target in a WebTest XML file checks that the doSetup was
already run using Ant's depends attribute, like this:
	&lt;target name="Test No6" depends="doSetUp"&gt;</pre>
</blockquote>
Does ant's "depends" automatically ensure that doSetUp is only run once
no matter how many times it is called in a sequence of targets?&nbsp; Why
then do you set a property of&nbsp; &lt;property name="alreadySetUp"
value="true"/&gt;
?<br>
<br>
RM<br>
<br>
on 05/12/06 14:30 Nate Oster said the following:
<blockquote
 cite="mid5E7FB6092A60DD4F80DF50239C561B1501562F56@MERCEDES.utopiasystems.net"
 type="cite">
  <pre wrap="">You can get around the limitation mentioned by George Bills, below, if
you include a standard setup file in each WebTest.  I don't think the
"ifStep" proposed earlier will work, since ifStep is itself a WebTest
step, not a native Ant task.

We use a common file called "WebTestSetup.xml"
It has one target, "doSetup", which declares the WebTest taskdef.
The last line in the doSetup target is:
	&lt;property name="alreadySetUp" value="true"/&gt;

Each WebTest XML file includes WebTestSetup.xml BEFORE any &lt;webtest&gt;
tags like this:
 	&lt;import file="[your path here]/WebTestSetup.xml"/&gt;  
THEN, each target in a WebTest XML file checks that the doSetup was
already run using Ant's depends attribute, like this:
	&lt;target name="Test No6" depends="doSetUp"&gt;

As a result, you can run any of our WebTests from a command line, or
include it in an &lt;antcall&gt; suite.  No matter what, the Taskdef only gets
called ONCE.  

Cheers!
Nate Oster

Date: Tue, 05 Dec 2006 13:54:31 +1100
From: George Bills <a class="moz-txt-link-rfc2396E" href="mailto:gbills@funnelback.com">&lt;gbills@funnelback.com&gt;</a>
To: <a class="moz-txt-link-abbreviated" href="mailto:webtest@lists.canoo.com">webtest@lists.canoo.com</a>
Subject: Re: [Webtest] Re: Memory Leak in Canoo
Reply-To: <a class="moz-txt-link-abbreviated" href="mailto:webtest@lists.canoo.com">webtest@lists.canoo.com</a>
Reply-To: George Bills <a class="moz-txt-link-rfc2396E" href="mailto:gbills@funnelback.com">&lt;gbills@funnelback.com&gt;</a>

I'm not sure if this is what you want, but you can pass properties from 
Ant script to Ant script - most ways of calling an Ant script pass 
properties from the parent to the child by default, and you can use 
"inheritall='true'" otherwise. I load "webtest.xml" once to define all 
the webtest stuff in my Ant test harness, and then that test harness 
calls the tests. The tests themselves don't need to include the webtest 
stuff at all - but that means that you can't run the tests individually 
(because they'll be missing the webtest definitions). Hope that helps.

Rob Manthey wrote:
&gt; (I'll probably be corrected shortly, but I think this is what Marc is 
&gt; getting at ...)
&gt;
&gt; This line (may have been slightly modified by me for my local 
&gt; conditions) must appear somewhere for webtest to work:
&gt;  &lt;taskdef file="${canoowebtest.home}/webtestTaskdefs.properties"/&gt;
&gt;
&gt; Anyway, each time it is included it instantiates a bunch of resources 
&gt; from the sounds of it and so it should only be run once per set of 
&gt; tests.  I guess this means wrapping it in some sort of conditional, 
&gt; but I have at the top of each file, so that's why (?) I accumulate 
&gt; memory usage when I hit "ant all" as the jvm is created once per ant 
&gt; session, but the webtest taskdef is called for every file.
&gt;
&gt; What is the optimal way to have the taskdef declared for each file, 
&gt; but so that it only gets called once if that file is referenced by 
&gt; wrapper files?   Such as:
&gt;
&gt;    &lt;ifStep description="Run Taskdef Once" 
&gt; unless="${taskdefLoaded}=='true'"&gt;
&gt;        &lt;taskdef
file="${canoowebtest.home}/webtestTaskdefs.properties"/&gt;
&gt;        &lt;property name="taskdefLoaded" value="true" /&gt;
&gt;    &lt;/ifStep&gt;


_______________________________________________
WebTest mailing list
<a class="moz-txt-link-abbreviated" href="mailto:WebTest@lists.canoo.com">WebTest@lists.canoo.com</a>
<a class="moz-txt-link-freetext" href="http://lists.canoo.com/mailman/listinfo/webtest">http://lists.canoo.com/mailman/listinfo/webtest</a>
  </pre>
</blockquote>
</body>
</html>

--------------060906060409030806080106--