Skip to content

Instantly share code, notes, and snippets.

@rendon
Created May 23, 2014 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rendon/e6df39b42e664c4904f4 to your computer and use it in GitHub Desktop.
Save rendon/e6df39b42e664c4904f4 to your computer and use it in GitHub Desktop.
Single Test Runner
#!/bin/bash
if [ -z $1 ]
then
echo "USAGE: $0 <test file without extension>";
echo "EXAMPLE: $0 TestQuickSort";
exit 1;
fi
cat > .build <<EOF
<?xml version="1.0" ?>
<project name="Test" default="compile">
<target name="compileTest" description="Compile tests">
<javac srcdir="." destdir="." includeantruntime="true">
<include name="$1.java" />
</javac>
</target>
<target name="test" depends="compileTest" description="Run tests">
<junit>
<batchtest>
<fileset dir=".">
<include name="$1.class" />
</fileset>
</batchtest>
<formatter type="plain" usefile="false" />
</junit>
</target>
</project>
EOF
ant -buildfile .build test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment