ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Cargo
Date Fri, 27 Oct 2006 15:46:23 GMT
EJ Ciramella wrote:
> I'm going to try here first before moving over to the cargo mailing
> lists.  Is anyone using this via ant?

-dont be afraid to talk to them, esp on the #iRC channel. If found them 
helpful

> To start up the server for integration testing, we use the <exec> task
> to start/stop the server currently.  The bad thing is, if there is a
> test failure, the server continues to run and winds up in some funky
> state.

Problem there is more exec, isnt it.


>  
> I'd like to use cargo to strictly start/stop the server depending on
> success/failure of the tests.
>  
> Is there any way to fork the startup of the server via cargo?  I don't
> see anything listed on their site.
> 

You can provide deploy/undeploy actions in the cargo task, so if you can 
kill the process, then yes, you can fork it during startup.

Now, I am busy using SmartFrog to deploy applications and start tests 
all as a choreographed deployment. If you want to use it then I would 
recommend you look at the video/slides on testing under 
http://smartfrog.org/. I should warn you, the stuff there is still 
stabilizing as I add new features to it (like single test execution, 
testNG support, etc).

Before I moved to in-smartfrog testing, I had an ant task to do more 
generic functional testing than cargo,<functionaltest>. It will start an 
application in one thread, in another wait for a probe to succeed, run a 
sequence of actions and then finally some teardown actions. It will even 
kill the app if the teardown doesnt do it:


     <sf-functionaltest testTimeout="600" shutdownTime="10">
       <application>
         <sf-startdaemon-debug failonerror="false" spawn="false"/>
       </application>
       <probe>
         <socket port="${smartfrog.daemon.port}" server="localhost"/>
       </probe>
       <test>
         <core:junit
             errorProperty="test.failed"
             failureProperty="test.failed"
             includeAntRuntime="true"
             >
           <sysproperty key="test.classes.dir"
               value="${test.classes.dir}"/>
           <!--all properties beginning with test-->
           <syspropertyset>
             <propertyref prefix="test."/>
           </syspropertyset>
           <classpath>
             <path refid="tests.run.classpath"/>
           </classpath>
           <batchtest todir="${test.data.dir}">
             <!-- bulk test case -->
             <fileset dir="${test.classes.dir}">
               <include name="org/smartfrog/**/system/**/*Test.class"/>
             </fileset>
           </batchtest>
         </core:junit>
         <fail if="failure">Junit failed</fail>
       </test>
       <teardown>
         <sf-stopdaemon failonerror="false"/>
         <sf-junitreport data="${test.data.dir}"
             reports="${test.reports.dir}"
             />
       </teardown>
     </sf-functionaltest>

It is hidden in the smartfrog SVN repository and in the source 
distributions; feel free to use it. the source is LGPL:
http://svn.sourceforge.net/viewvc/smartfrog/trunk/core/extras/ant/src/org/smartfrog/tools/ant/FunctionalTestTask.java?view=markup

look at the execute() method if you want to see complexity. You'd be 
hard press to encode that logic in a build file.

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


Mime
View raw message