[Webtest] Re: Memory Leak in Canoo

George Bills George Bills <gbills@funnelback.com>
Tue, 05 Dec 2006 13:54:31 +1100

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>