2 Replies Latest reply on Mar 2, 2010 9:49 AM by elfuhrer

    Unable to run default unit tests

    elfuhrer Novice

      I'm sure this is a simple problem and yet I can't find the little missing detail, note that the same approach was working prior to version 2.2.0.GA
      I have create a sample application using seam-gen and I need to run some tests on my entities.

      I have created the following test case

      public class DummyTest extends SeamTest {
          public void testSaleHomeComponent() throws Exception {
           new ComponentTest() {
               protected void testComponents() throws Exception {
                EntityManager em = (EntityManager) getInstance("entityManager");
                assert (em != null);

      I have added the required the dependencies to the classpath and I created the following sample testng suite file in DummySuiteTest.xml

      <suite name="Simple Test Suite" verbose="2" parallel="false">
          <test name="Model">
                  <class name="org.webpatterns.agora.lab.seam.test.DummyTest" />

      Now I get the following exception:

      java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/entityManager

      Any help is highly appreciated, I have seen Dan's post about the issue but still it didn't solve my problem

        • 1. Re: Unable to run default unit tests
          Ilya Dyoshin Novice

          as I can remember the problem was with environment, as I can remember the default persistence.xml profile for unittests is production, and if you changed something in the development - that wouldn't be available at tests. look at the build.xml and change it to deploying your current working profile, or simply move your configuration across of profiles.


          Ilya Dyoshin

          • 2. Re: Unable to run default unit tests
            elfuhrer Novice

            That didn't work out at all, the reference to entityManager is not bound however the reference to the DefaultDS exists. I have tried to update the test configuration to match Dan's proposal but still I got the exception others have gone through.