new <functionaltest> task
Steve Loughran <[email protected]> Wed, 08 Mar 2006 20:49:06 +0000
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <[email protected]> |
I havent gone near the junit components yet, but I have been enhancing
ant's ability to do functional testing, taking the idea of the apache
cactus test runner (that deploys and tests a web application) and making
it more generic. So now we have a <functionaltest> task that
-runs a setup sequence
-in parallel
-an application; another sequence of ant tasks
-a sequence of
-a probe (a waitfor) that spins until a condition is met
-a junit task
-a teardown sequence
Once setup is successful, the teardown sequence always runs, even if
there is a failure in the parallel bits -and it is the error inside the
parallel bits that will be reported, even if something goes wrong with
the teardown.
From the unit tests
<sf-functionaltest testTimeout="10">
<setup>
<echo>setup</echo>
</setup>
<application>
<echo>application</echo>
<fail>failure!</fail>
</application>
<junit />
<teardown>
<echo>teardown</echo>
<fail>TEARDOWN!</fail>
</teardown>
</sf-functionaltest>
There's also now a <faultingwaitfor> that throws a fault if it times out
before a condition is met.
I havent used this in production yet; the jetty/cargo components will be
the first targets. Its designed so that you can either deploy something
in startup and undeploy it in teardown, or you can start something like
the sfdaemon in the <application> sequence then terminate it in
teardown. The <probe> element is there to block testing until the
application is up and running..
This example (another test) blocks the tests until the application
sequence sets a property
<sf-functionaltest testTimeout="10">
<setup>
<echo>setup</echo>
</setup>
<application>
<echo>application</echo>
<sleep seconds="2" />
<property name="app.property" value="true" />
</application>
<probe>
<isset property="app.property" />
</probe>
<junit />
<teardown>
<echo>teardown</echo>
</teardown>
</sf-functionaltest>
Its all still unstable right now, and not something we need to document
just yet, but people may find it interesting/useful. Its not smartforg
specific either; its designed to test against anything that can be
started and stopped and for which we have a probe,.
-steve
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642