17-10. Automating Unit Tests for PL/SQL and Java Stored Procedures Using Ant

Problem

You wish to automatically run your unit tests for PL/SQL code and Java stored procedures each day and to write the results of the unit test to a file.

Solution

Use Apache's Ant build system to perform unit testing on your PL/SQL code. At the same time, Ant can build and compile any Java code that you will be using for your stored procedures. To do so, develop an Ant build script that will execute some SQL statements, automate your unit tests, and compile Java source into a directory. For example, the following build.xml file is an example of such a build that can be used to compile Java sources and execute unit tests on PL/SQL within a single Ant run.

<project ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.