Skip to content
Browse files

More robust junit invocation and reporting.

Specifically:
 - set basedir on junit tests.
 - pass along debug flag to java compiler.
 - produce and clean text-formatted reports from junit.
 - roundtrip test clearer about directory-not-found error.
  • Loading branch information...
1 parent 803650e commit 10c59af82ecda1e3fbb700bf935d197a501f9fcb @league committed Aug 27, 2009
Showing with 15 additions and 2 deletions.
  1. +9 −2 build.xml
  2. +6 −0 net/contrapunctus/lzma/RoundTripTest.java
View
11 build.xml
@@ -13,6 +13,7 @@
<property name="version" value="${major}.${minor}" />
<property name="package" value="net/contrapunctus/lzma" />
<property name="jarfile" value="lzmajio.jar" />
+ <property name="debug" value="no" />
<uptodate srcfile="${package}/Version.template"
targetfile="${package}/Version.java"
@@ -36,7 +37,7 @@
</target>
<target name="compile" depends="init,version-stamp">
- <javac srcdir="." destdir="build">
+ <javac srcdir="." destdir="build" debug="${debug}">
<classpath>
<path refid="test-path" />
</classpath>
@@ -73,10 +74,13 @@
</target>
<target name="test" depends="compile">
- <junit printsummary="yes" showoutput="yes" haltonfailure="yes">
+ <echo>Base dir is ${basedir}</echo>
+ <junit printsummary="yes" showoutput="yes" haltonfailure="yes"
+ fork="yes" dir="${basedir}">
<classpath>
<path refid="test-path" />
</classpath>
+ <formatter type="plain"/>
<batchtest>
<fileset dir=".">
<include name="**/*Test.java" />
@@ -88,6 +92,9 @@
<target name="clean">
<delete dir="build" />
<delete dir="docs" />
+ <delete>
+ <fileset dir="." includes="TEST-*.txt" />
+ </delete>
</target>
<target name="distclean" depends="clean">
View
6 net/contrapunctus/lzma/RoundTripTest.java
@@ -20,9 +20,15 @@
public class RoundTripTest
{
@Parameters public static Collection<Object[]> files()
+ throws FileNotFoundException
{
File dir = new File("tests/roundtrip");
File[] fs = dir.listFiles();
+ if(null == fs)
+ {
+ throw new FileNotFoundException
+ ("directory tests/roundtrip not found");
+ }
Collection<Object[]> args = new ArrayList<Object[]>();
for(File f : fs)
{

0 comments on commit 10c59af

Please sign in to comment.
Something went wrong with that request. Please try again.