
Chapter 9 Generating Persistent Objects for Java and JSF Pages
Running unit tests with Ant
To generate the Ant build.xml file, you need to select the Generate Ant build.xml file in the Java code generation window.
To use Ant, you need to:
- Download it from www.apache.org
and install it.
- Define an environment variable ANT_HOME and set it to your Ant installation directory.
- Copy junit-3.8.1.jar from HIBERNATE_HOME/lib directory to ANT_HOME/lib directory.
- Make sure that the Hibernate Jar files are defined in the build.xml file or in the CLASSPATH environment variable.
- Make sure that the JDBC driver Jar file of your database is defined in the build.xml file or in the CLASSPATH environment variable.
To run unit tests with Ant from PowerDesigner:
- Select Language→Generate Java Code
- Select the Options tab.
- Set the Generate Ant build.xml file option to true.
- Select the Tasks tab.
- Check the Hibernate: Run the generated unit tests task.
- Click OK.
- After you close the generation files list window, the JUnit task runs. You can see the result in output window.
To run unit tests with Ant from the command line:
- Open a command line window.
- Go to the directory where you have generated the code.
- Run the JUnit test task: Ant junit
- Check the output result.
Copyright (C) 2006. Sybase Inc. All rights reserved.
|
|