test target
tom.elrod Apr 26, 2005 4:00 PMI am working on converting my test.functional target from the old JBossRemoting build to the new jboss build. The old one looks like:
<target name="tests.functional" depends="tests.jars"> <mkdir dir="${output.tests.results}"/> <junit printsummary="true" fork="yes" includeantruntime="true"> <classpath> <path refid="tests.classpath"/> <pathelement location="${output.lib.dir}/jboss-remoting-tests.jar"/> </classpath> <!-- this is needed for the remoting.marshall.dynamic.remote.MarshallerLoadingServer --> <jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-test.jar"/> <formatter type="xml"/> <batchtest fork="yes" todir="${output.tests.results}" haltonfailure="no"> <formatter type="xml"/> <fileset dir="${tests.compile.dir}"> <include name="**/remoting/**/*TestCase.class"/> <exclude name="**/remoting/**/performance/**"/> </fileset> </batchtest> </junit> </target>
There are few specializations I need. First, is want to specifiy exactly what will be included on the classpath for the test run (so jboss-remoting-loading-test.jar is not included). Then want to pass a jvmarg indicating where the jboss-remoting-loading-test.jar is located (this is a for a test of remote classloading).
My jbossbuild.xml currently looks like:
<source id="tests" test="org/jboss/test/remoting/**/*TestCase.java"> <include input="main"/> <include component="apache-commons"/> <include component="oswego-concurrent"/> <include component="apache-log4j"/> <include component="junit-junit"/> <include component="sun-jmx"/> <include component="sun-jaxp"/> <include component="javagroups-javagroups"/> <include component="common"/> <include component="naming"/> <include component="j2se"/> <include component="system"/> <include component="aop"/> </source>
I am still not totally clear on the source tags and what exactly they are defining (can these be any free form strings, or do they have to be 'main', 'test', etc.?). I found where specifing a 'test' attribute with the string expresession for the test you want run will be used within the 'runtest' targetdef from task.xml (which will indeed run my tests when run the 'test' target for the build. Am not sure how to specify a string expression for the files I want excluded.
So now just need to be able to specify exactly the jars included on the classpath for the test run and how to pass the jvmarg parameter. I see that runtest uses pathElements for the classpath, but don't know where the values come from. I guess the jvmarg can be added to the runtest taskdef as well, but am not sure how to make it conditional depending of if there is a variable defined for it within the jbossbuild.xml.
Thanks.
-Tom