Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Development/Testing/JPA"

(Running the JPA Junit tests)
(Ant)
Line 7: Line 7:
  
 
===Ant===
 
===Ant===
The eclipselink.jpa.test directory contains a build.xml to run the
+
The eclipselink.jpa.test/build.xml contains several ant targets for testing.  The "test" target will run the JPA LRG.  Ensure that the eclipselink.jpa.test/run directory contains a test.properties file that includes configuration information for your database.
 +
 
 +
  ant test
 +
 
 +
This will run the JPA LRG, the results will be output into the run directory as html.
  
 
===Eclipse JUnit===
 
===Eclipse JUnit===

Revision as of 16:02, 3 December 2007

Running the JPA tests

The JPA tests can be run in several ways.

  • ant
  • Eclipse JUnit
  • Testing Browser

Ant

The eclipselink.jpa.test/build.xml contains several ant targets for testing. The "test" target will run the JPA LRG. Ensure that the eclipselink.jpa.test/run directory contains a test.properties file that includes configuration information for your database.

 ant test

This will run the JPA LRG, the results will be output into the run directory as html.

Eclipse JUnit

The JPA test suite is written using JUnit. It consists of a set of jars that contain various persistence units and a number of tests. The JPA tests are contained in the eclipselink.jpa.core.test project

  1. Ensure you have an eclipselink jar available on your classpath. This jar is checked in to the foundation component in the SVN repository and can be created by running the ant build located in the eclipselink.core project.
  2. Run the build.xml in base directory of jpa.core.test. This will create a set of jar files containing the persistence units.
  3. Copy the test.properties file from jpa.core.test/resource to the base directory of eclipselink.jpa.core.test and edit it to include information necessary to connect to your database
  4. Create a JUnit run target
    1. The project will be: eclipselink.jpa.core.test
    2. The test class will be: org.eclipse.persistence.testing.tests.jpa.FullRegressionTestSuite
    3. Add the JVM argument "-javaagent:<eclipselink-jar-location>/eclipselink.jar" - This will allow the test models to run with weaving enabled
    4. Add to your classpath the following:
      1. Your JDBC driver
      2. A library that includes all the jar files generated by the build.xml in jpa.core.test you ran earlier
  5. Run the run target you created

Back to the top