Skip to content

Commit

Permalink
bobo-contrib: add ant test target
Browse files Browse the repository at this point in the history
  • Loading branch information
McCracken Kenneth authored and McCracken Kenneth committed Dec 13, 2011
1 parent 9538690 commit 45f833a
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion bobo-contrib/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@
<property name="jar.name.append" value="-${revision}" />

<property name="test.dir" value="test" />
<property name="test.src.dir" value="test" />
<property name="test.report.dir" value="${target.dir}/${test.dir}/report" />
<property name="test.html.dir" value="${target.dir}/${test.dir}/html" />
<property name="logs" value="logs" />

<property name="default-test-suite" value="unit" />
<property name="test.max.memory" value="150m" />
<property name="test.forkmode" value="once" />
<property name="test.resources.dir" value="test-resources" />
<property name="default.encoding" value="UTF-8" />
<property name="target.test.classes" value="${target.dir}/${test.dir}/classes" />

<path id="bobo-contrib-classpath">
<!--
<dirset dir="${target.dir}">
Expand All @@ -31,6 +39,20 @@
<include name="*.jar" />
</fileset>
</path>

<path id="test.classpath">
<path refid="bobo-contrib-classpath"/>
<fileset dir="../lib/test">
<include name="*.jar" />
</fileset>
<fileset dir="${target.dir}">
<include name="${jar.name}${jar.name.append}.jar"/>
</fileset>
<!-- ${target.dir}/${test.dir}/${test.dir}-${jar.name}.jar -->
<fileset dir="${target.dir}/${test.dir}">
<include name="${test.dir}-${jar.name}.jar" />
</fileset>
</path>

<target name="clean">
<delete dir="${target.dir}" />
Expand Down Expand Up @@ -67,8 +89,60 @@ xcludes}">
<classpath refid="bobo-contrib-classpath" />
</javac>
</target>

<!-- test target needs some work -->
<target name="buildtests" description="Compile test tree java files">
<mkdir dir="${target.test.classes}" />
<javac srcdir="${test.src.dir}" destdir="${target.test.classes}" source="1.6" target="1.6" debug="true" deprecation="false" optimize="false" failonerror="true" encoding="${default.encoding}">
<classpath refid="test.classpath" />
</javac>
<echo message="test.resources.dir = ${test.resources.dir}"/>
<copy todir="${target.test.classes}">
<fileset dir="${test.resources.dir}">
<include name="*.xml" />
<include name="log4j.properties" />
</fileset>
</copy>
</target>

<target name="disttest" depends="buildtests" description="Generates the test jar file">
<jar destfile="${target.dir}/${test.dir}/${test.dir}-${jar.name}.jar" basedir="${target.test.classes}" />
</target>

<target name="test" depends="dist,disttest">
<mkdir dir="${target.dir}/${test.dir}/test-report" />

<property name="test-suite" value="${default-test-suite}" />

<echo>
**** Running test suite: ${test-suite} ****
</echo>

<property name="include.pattern" value="**/*Test.*" />

<junit printsummary="withOutAndErr" fork="true" forkmode="${test.forkmode}"
maxmemory="${test.max.memory}" haltonfailure="false" failureproperty="tests.failed"
showoutput="true">
<sysproperty key="test-suite" value="${test-suite}" />

<classpath refid="test.classpath" />

<formatter type="xml" />
<batchtest todir="${target.dir}/${test.dir}/test-report">
<fileset dir="${target.test.classes}">
<include name="${include.pattern}" />
</fileset>
</batchtest>
</junit>

<junitreport todir="${target.dir}/${test.dir}/test-report">
<fileset dir="${target.dir}/${test.dir}/test-report">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" todir="${target.dir}/${test.dir}/test-report" />
</junitreport>

</target>

<target name="dist" depends="build" description="generates the jar file">
<manifest file="MANIFEST.MF">
Expand Down
Binary file added bobo-contrib/lib/jmock-2.5.1.jar
Binary file not shown.

0 comments on commit 45f833a

Please sign in to comment.