Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to run EclipseLink unittests inside Eclipse?

Hi Patric,

Hopefully I can help. I am going to assume you want to start with the JPA tests. If that is not the case, let me know.

http://wiki.eclipse.org/EclipseLink/Development/Testing/JPA#Eclipse_JUnit

  A couple of comments

1. The easiest way to ensure all the necessary components are built is to run the ant build from the base directory. (You need an eclipselink.jar and to have run the build in the eclipselink.jpa.test directory and the full build will do both of these)

2. The build of eclipselink.jpa.test creates persistence unit jars for the test. You will need to run that build each time you add or remove classes from the model. Take a look at the jpa\eclipselink.jpa.test directory after you have built and you will see all the persistence units.

2. If you prefer not to edit the eclipselink.jpa.test/test.properties, you can provide the database information in your user home directory and call it test.properties. Any information in that file will override anything defined in eclipselink.jpa.test/test.properties.

3. The eclipselink.jpa.test project contains a good launch target to start with called FullRegressionTestSuite.launch.



Let me know what problems you are having,
Tom


Patric Rufflar wrote:
Hello,

I'd like to know how to setup eclipselink in Eclipse that I can ran the provided test suites or add some new.

I read:
http://wiki.eclipse.org/EclipseLink/Building#Minimum_SVN_Trunk_projects_for_JPA_or_Core_Eclipse_Development_and_Testing
and
http://wiki.eclipse.org/EclipseLink/Development/Testing/Prereq

I setup an eclipse project using the eclipselink sources which compiled successfully.
But when I try to ran some tests or testsuites I am getting:

javax.persistence.PersistenceException: No Persistence provider for EntityManager named default at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:402) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:385) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:412) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getServerSession(JUnitTestCase.java:373) at org.eclipse.persistence.testing.tests.jpa.orphanremoval.OrphanRemovalJUnitTestCase.testSetup(OrphanRemovalJUnitTestCase.java:1058)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:466)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
(or similar stack traces).

Which persistence.xml must be used? Is there some process which creates or moves the correct persistence.xml? Do I have to create some tables (or run a script) in order to run the tests?

Thank you for your help and best regards,
Patric


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top