You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by simon <si...@wyona.com> on 2006/02/08 15:09:00 UTC

keep going after error

hello list

i have a target for a cruisecontrol test.

  <target name="htmlunit-meta" description="htmlunit-meta target">
    <echo>Starting Lenya..</echo>
    <exec dir="${basedir}" resolveexecutable="true"
executable="start-lenya.sh" spawn="true"/>
    <sleep seconds="20"/>
    <waitfor maxwait="40" maxwaitunit="second" checkevery="4000">
        <and>
          <socket server="192.168.100.108" port="8899"/>
        </and>
    </waitfor>
    <ant dir="../../../test" inheritAll="false">
      <property name="build.properties.file"
value="adspotlight.build.properties"/>
    </ant>
    <echo>Stopping Lenya..</echo>
    <exec dir="${basedir}" resolveexecutable="true"
executable="stop-lenya.sh" spawn="true"/>
  </target>

it executes a shell scrip that start the webapp. then it uses ant to
test the webapp and after the test it should stop the webapp.

it works fine as long as the tests are working fine, but as soon a test
fails the whole things is stoped and does not execute the stop script
for the webapp. but it is important execute the last step even if the
step before fails.

does sombody have a hint for me?

TIA

simon

-- 
Simon Litwan                               simon.litwan@wyona.com
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: keep going after error

Posted by Nicolas Vervelle <ni...@steria.com>.
I think there's a <trycatch> task in ant-contrib that should do just 
what you are looking for

> simon wrote:
>
>> it executes a shell scrip that start the webapp. then it uses ant to
>> test the webapp and after the test it should stop the webapp.
>>
>> it works fine as long as the tests are working fine, but as soon a test
>> fails the whole things is stoped and does not execute the stop script
>> for the webapp. but it is important execute the last step even if the
>> step before fails.
>>
>> does sombody have a hint for me?
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: keep going after error

Posted by simon <si...@wyona.com>.
On Mit, 2006-02-08 at 14:33 +0000, Steve Loughran wrote:
> simon wrote:
> > hello list
> > 
> > i have a target for a cruisecontrol test.
> > 
> >   <target name="htmlunit-meta" description="htmlunit-meta target">
> >     <echo>Starting Lenya..</echo>
> >     <exec dir="${basedir}" resolveexecutable="true"
> > executable="start-lenya.sh" spawn="true"/>
> >     <sleep seconds="20"/>
> >     <waitfor maxwait="40" maxwaitunit="second" checkevery="4000">
> >         <and>
> >           <socket server="192.168.100.108" port="8899"/>
> >         </and>
> >     </waitfor>
> >     <ant dir="../../../test" inheritAll="false">
> >       <property name="build.properties.file"
> > value="adspotlight.build.properties"/>
> >     </ant>
> >     <echo>Stopping Lenya..</echo>
> >     <exec dir="${basedir}" resolveexecutable="true"
> > executable="stop-lenya.sh" spawn="true"/>
> >   </target>
> > 
> > it executes a shell scrip that start the webapp. then it uses ant to
> > test the webapp and after the test it should stop the webapp.
> > 
> > it works fine as long as the tests are working fine, but as soon a test
> > fails the whole things is stoped and does not execute the stop script
> > for the webapp. but it is important execute the last step even if the
> > step before fails.
> > 
> > does sombody have a hint for me?
> > 
> 
> The way I have done this is dont have the junit tests fail, instead set 
> a property if there was an error or failure. Then you shut down the 
> server after running the tests and before creating the reports and 
> calling <fail>
> 

that worked for me.

thanks a lot

simon



> More recently I've been using cactus, which has an extended junit task 
> that lets you declare different  <sequence>s to
> run to start or stop an app server before and after running the tasks. I 
> think it's a bit cactus biased, but may work for lenya too.
> 
> -steve
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
-- 
Simon Litwan                               simon.litwan@wyona.com
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: keep going after error

Posted by Steve Loughran <st...@apache.org>.
simon wrote:
> hello list
> 
> i have a target for a cruisecontrol test.
> 
>   <target name="htmlunit-meta" description="htmlunit-meta target">
>     <echo>Starting Lenya..</echo>
>     <exec dir="${basedir}" resolveexecutable="true"
> executable="start-lenya.sh" spawn="true"/>
>     <sleep seconds="20"/>
>     <waitfor maxwait="40" maxwaitunit="second" checkevery="4000">
>         <and>
>           <socket server="192.168.100.108" port="8899"/>
>         </and>
>     </waitfor>
>     <ant dir="../../../test" inheritAll="false">
>       <property name="build.properties.file"
> value="adspotlight.build.properties"/>
>     </ant>
>     <echo>Stopping Lenya..</echo>
>     <exec dir="${basedir}" resolveexecutable="true"
> executable="stop-lenya.sh" spawn="true"/>
>   </target>
> 
> it executes a shell scrip that start the webapp. then it uses ant to
> test the webapp and after the test it should stop the webapp.
> 
> it works fine as long as the tests are working fine, but as soon a test
> fails the whole things is stoped and does not execute the stop script
> for the webapp. but it is important execute the last step even if the
> step before fails.
> 
> does sombody have a hint for me?
> 

The way I have done this is dont have the junit tests fail, instead set 
a property if there was an error or failure. Then you shut down the 
server after running the tests and before creating the reports and 
calling <fail>

More recently I've been using cactus, which has an extended junit task 
that lets you declare different  <sequence>s to
run to start or stop an app server before and after running the tasks. I 
think it's a bit cactus biased, but may work for lenya too.

-steve


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org