Chapter 9. Running JUnit tests from Ant
John Brunner
This chapter covers
- Introducing Ant and Ivy
- Running Ant JUnit tasks
- Creating reports
In this chapter, we look at Apache Ant[1] or Ant for short, a free and open source build tool with direct support for JUnit. You can use Ant with any Java programming environment. We show you how to be more productive with JUnit by running tests as part of the build. We also show you how to set up your environment to build Java projects, manage JAR file dependencies, execute JUnit tests, and generate JUnit reports.
For unit tests to be effective, they must be part of the development routine. Most development cycles begin by checking out code from the source code repository. Before making any changes, prudent developers first run all unit test suites. Many teams have a rule that all unit tests in the repository must pass. Before starting any development, you should check to make sure all tests pass. You should always be sure that your work starts from a known stable baseline.