The build.xml file I use for my template project is available here.
The general steps for the test task are are as follows:
1) Make a test report directory
2) Specify a property that serves as a match for tests
3) The junit task takes a variety of arguments
fork - run tests in separate JVM
printsummary - print a separate line for each test case
haltonerror - halt the build if an error occurs during a test
haltonfailure - halt the build if a test fails
4) Specify a formatter and whether or not to use file based output (I set it to false as I prefer to see the output at console initially)
5) Define a set of tests based on pattern matching
6) Define a classpath
More information on the JUnit Ant Task is available here.