7 Replies Latest reply on Jun 14, 2012 8:34 AM by Charlee Chitsuk

    The Arquillian test case which sharing super class for deployment only succes with 2 rounds.

    Charlee Chitsuk Newbie

      Dear All,

       

       

      I'm in the Eclipse/Maven/Arquillian/Glassfish-Embedded environment. I've the JUnit/Arquillian test case which shares the super class for deployment as the following: -

       

      h4. The Utility for creating ear

       

      {code:java}

          public class ArchivePreparation {

       

              private static final EnterpriseArchive EAR;

       

              //Getter here

       

              static {

                 EAR = getDeployinngEar();

              }

       

              private static EnterpriseArchive getDeployingEar() {

                 //Create and return the ear.

              }

          }

      {code}

       

      h4. The super class

       

      {code:java}

          public class AbstractTester {

              @Deployment

              public static EnterpriseArchive deploy() {

                  return ArchivePreparation.getEAR();

              }

          }

      {code}

       

      h4. The test case #1, #2, #3 and #4: It is same coding.

       

      {code:java}

          @RunWith(Arquillian.class)

          public class EarTester1 extends AbstractTester {

       

              @EJB

              private DummyServiceable serviceEjb;

       

              @Test

              public void whenPerform() {

                  Assert.assertNotNull("The service ejb is null.",

                                        this.serviceEjb);

              }

       

          }

      {code}

       

      h4. The JUnit test suite

       

      {code:java}

          @RunWith(Suite.class)

          @SuiteClasses({

              EarTester1.class,

              EarTester2.class,

              EarTester3.class,

              EarTester4.class,

          })

          public class ArquillianMultipleTestSuite {

          }

      {code}

         

       

      When I execute the ArquillianMultipleTestSuite, for both inside the Eclipse and command line with mvn test,

      *+Only the EarTester #1 and #2 is success. The #3 and #4 _are always fail 100%_.+*

      Since all test cases are the same coding, I'm very confused and have no idea why it is failure. Could you please help to advise further? Thank you very much for your help in advance. I'm looking forward to hearing from you soon.

       

      Regards,

       

      Charlee Ch.