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: -
The Utility for creating ear
public class ArchivePreparation {
privatestaticfinal EnterpriseArchive EAR;
//Getter here
static {
EAR = getDeployinngEar();
}
privatestatic EnterpriseArchive getDeployingEar() {
//Create and return the ear.
}
}
The super class
public class AbstractTester {
@Deployment
publicstatic EnterpriseArchive deploy() {
return ArchivePreparation.getEAR();
}
}
The test case #1, #2, #3 and #4: It is same coding.
@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);
}
}
The JUnit test suite
@RunWith(Suite.class)
@SuiteClasses({
EarTester1.class,
EarTester2.class,
EarTester3.class,
EarTester4.class,
})
public class ArquillianMultipleTestSuite {
}
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.
I also create the project for reproducing at the github.com as the following information :-