From: Scott M S. <sco...@jb...> - 2005-05-26 17:07:02
|
I have added a run-junit that can be used in place of all the repeated junit task usage to cleanup the duplication: <!-- A macro to execute a junit task. macro attributes: junit.patternset : require patternset id that identifies the junit test classes to run junit.configuration : option name used to unique a unit test that is run more than once. The junit.configuration value is appended to the test name as (@{junit.configuration}) while the output file extension is -@{junit.configuration}.xml. junit.syspropertyset : optional propertyset id that will be passed as system properties to the junit jvm. --> <macrodef name=3D"run-junit" description=3D"Run a batch of junit on the given patternset"> <attribute name=3D"junit.patternset" description=3D"The patternset used to select the tests to run" = /> <attribute name=3D"junit.configuration" default=3D""=20 description=3D"An optional configuration name added to the test and extention" /> <attribute name=3D"junit.syspropertyset" default=3D""=20 description=3D"An optional propertyset id that will be passed = as system properties" /> Here is an example using the junit.syspropertyset in the tomcat-ssl-tests: <target name=3D"tomcat-ssl-tests" description=3D"Tomcat tests requiring an SSL connector"> <!-- Create the ssl enabled tomcat config --> <create-config baseconf=3D"default" newconf=3D"tomcat-ssl"> <patternset> <include name=3D"conf/**"/> <include name=3D"deploy/jbossweb*.sar/**"/> <include name=3D"deploy/jmx-invoker-service.xml"/> <include name=3D"lib/**"/> </patternset> </create-config> <start-jboss conf=3D"tomcat-ssl"/> <wait-on-host/> <!-- Specify the JSSE properties --> <property name=3D"javax.net.ssl.keyStore" =20 value=3D"${build.resources}/test-configs/tomcat-ssl/conf/client.keystore"= / > <property name=3D"javax.net.ssl.keyStorePassword" value=3D"unit-tests-client"/> <property name=3D"javax.net.ssl.trustStore" =20 value=3D"${build.resources}/test-configs/tomcat-ssl/conf/client.keystore"= / > <property name=3D"javax.net.ssl.trustStorePassword" value=3D"unit-tests-client"/> =20 =20 <propertyset id=3D"tomcat-ssl-tests-props"> <propertyref prefix=3D"javax.net.ssl"/> </propertyset> <run-junit junit.patternset=3D"tc-ssl.includes" junit.syspropertyset=3D"tomcat-ssl-tests-props" /> <stop-jboss/> <wait-on-shutdown conf=3D"tomcat-ssl"/> </target>=20 Here is an example using the junit.configuration: <target name=3D"jrmp-invoker-tests" description=3D"EJB tests using the jrmp invoker"> <!-- Create the jrmp invoker enabled config --> <create-config baseconf=3D"default" newconf=3D"jrmp-invoker"> <patternset> <include name=3D"conf/**"/> <include name=3D"deploy/**"/> <include name=3D"lib/**"/> </patternset> </create-config> <start-jboss conf=3D"jrmp-invoker"/> <wait-on-host/> <run-junit junit.patternset=3D"jrmp-invoker.includes" junit.configuration=3D"JRMP-Invoker" /> <stop-jboss/> </target> xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology Officer JBoss Inc. xxxxxxxxxxxxxxxxxxxxxxxx=20 =20 |