0 Replies Latest reply on May 6, 2015 8:17 AM by Federico Rieckhof

    Unable to run multiple test classes on embeded Tomcat

    Federico Rieckhof Newbie

      Hello,

      I am developing an application in tomcat using Guice for transaction and injection and Vaadin as GUI Frameowrk. We are using Arquillian and Graphene to run the UI tests and h2 DB.  I have modularized the test in multiple classes and each has the same Deployment that is described in the Super class. The problem is when running only 1 class all test methods are green. But when running classes one after the other the second one close with some strange error messages.

       

      Below is the code of the classes like i said if I execute MasterIndexPageIT before any other class has deploy the it will ok, but if any ohter class has deployed before or i run two classes that do the same i get exceptions.

      From debugging i see that the after the second deployment the method setUp() do not get executed therefore testPageLoad fails. But i also get MasterIndexPageIT.setUp »  No runnable methods what makes no sense, but explains why setUp do net executed.

       

      So how can I run two test classes after each other from a suite or from maven failsafe with out getting this problems?

       

      I am Using the embedded tomcat container 1.0.0.CR7

      an the following versions of the dependecies

              <arquillian-bom.version>1.1.5.Final</arquillian-bom.version>

              <shrinkwrap-descriptors-bom.version>2.0.0-alpha-7</shrinkwrap-descriptors-bom.version>

              <shrinkwrap-resolver-bom.version>2.1.1</shrinkwrap-resolver-bom.version>

              <arquillian-drone-bom.version>2.0.0.Alpha4</arquillian-drone-bom.version>

              <selenium-bom.version>2.45.0</selenium-bom.version>

              <arquillian-guice.version>1.0.0.Alpha2</arquillian-guice.version>

              <tomcat.version>7.0.61</tomcat.version>

       

      @RunWith(Arquillian.class)

      public abstract class BaseArquillianTestCase {

      @Deployment(name = DEPLOYMENT_NAME_MASTER)

          public static WebArchive createMasterDeployment() throws IOException {

              WebArchive webArchive = ShrinkWrap.createFromZipFile(WebArchive.class, new File(DEPLOYMENT_PATH_MASTER));

             ...

              return webArchive;

          }

      }


      @GuiceWebConfiguration

      @RunWith(Arquillian.class)

      public class MasterIndexPageIT extends BaseArquillianTestCase {

      @Inject

          AuthenticationService authentificator;

       

          @Inject

          UsersRepository userRepository;

       

          @Inject

          TestDbPersistModule persistanceService;

       

      @Test

          @RunAsClient

          public void testPageLoad(@InitialPage final MasterIndexPageObject masterIndexPage)

                  throws Exception {

              Assert.assertEquals(MasterIndexPageObject.PAGE_TITLE, masterIndexPage.getPageTitle());

          }

       

          @Test

          @InSequence(-1)

          public void setUp() throws ServiceException, RepositoryException {

              final String dataName = "admin";

              UserItem data = new UserItem();

              data.setMailaddress("admin@gmail.de");

              data.setUserid(1);

              this.authentificator.storeUserDataInSession(data);

       

              this.userRepository.add(data);

              UserItem item = this.userRepository.getByUserEmail("admin@bmw.de");

       

              Assert.assertNotNull(item);

              Assert.assertEquals(dataName, item.getLogin());

          }

      }