Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/Testing/JPA"
(→Eclipse JUnit) |
(→Eclipse JUnit) |
||
Line 20: | Line 20: | ||
# Copy the test.properties file from eclipselink.jpa.test/test to the base directory of eclipselink.jpa.test and edit it to include information necessary to connect to your database | # Copy the test.properties file from eclipselink.jpa.test/test to the base directory of eclipselink.jpa.test and edit it to include information necessary to connect to your database | ||
# Create a JUnit run target | # Create a JUnit run target | ||
− | ## The project will be: eclipselink.jpa | + | ## The project will be: eclipselink.jpa.test |
## The test class will be: org.eclipse.persistence.testing.tests.jpa.FullRegressionTestSuite | ## The test class will be: org.eclipse.persistence.testing.tests.jpa.FullRegressionTestSuite | ||
## Add the JVM argument "-javaagent:<eclipselink-jar-location>/eclipselink.jar" - This will allow the test models to run with weaving enabled | ## Add the JVM argument "-javaagent:<eclipselink-jar-location>/eclipselink.jar" - This will allow the test models to run with weaving enabled | ||
## Add to your classpath the following: | ## Add to your classpath the following: | ||
### Your JDBC driver | ### Your JDBC driver | ||
− | ### A library that includes all the jar files generated by the build.xml in jpa | + | ### A library that includes all the jar files generated by the build.xml in jpa.test you ran earlier |
# Run the run target you created | # Run the run target you created | ||
Revision as of 10:39, 11 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.test project
- 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.
- Run the build.xml in base directory of eclipselink.jpa.test. This will create a set of jar files containing the persistence units.
- Copy the test.properties file from eclipselink.jpa.test/test to the base directory of eclipselink.jpa.test and edit it to include information necessary to connect to your database
- Create a JUnit run target
- The project will be: eclipselink.jpa.test
- The test class will be: org.eclipse.persistence.testing.tests.jpa.FullRegressionTestSuite
- Add the JVM argument "-javaagent:<eclipselink-jar-location>/eclipselink.jar" - This will allow the test models to run with weaving enabled
- Add to your classpath the following:
- Your JDBC driver
- A library that includes all the jar files generated by the build.xml in jpa.test you ran earlier
- Run the run target you created
Testing Browser
The JPA tests can also be run through the foundation Testing Browser. This provides additional debugging capabilities so is sometimes desired. There are some JPA tests that extend the foundation test framework, which are not run through the normal JUnit test target. The "JPA Tests" in the Testing Browser include these tests.
The eclipselink.jpa.test Eclipse project contains launch file for running the testing browser. The database login information and logging level can be configured. If you have previously run the JPA on the same database the "Fast" checkbox can be used to avoid recreating the database.