[Webtest] Re: Memory Leak in Canoo

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

Thanks Nate, I'm just one detail off I think ... how exactly do you then 
use (depends, if, etc) the "alreadySetUp" property ... ?  I can guess 
and work it out for myself, but I'm keen to see where you have it.
As an after thought, does anyone want to comment on whether the 
loaderref property in the taskdef target has any relevance to this 

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