0 Replies Latest reply on Apr 9, 2007 3:12 AM by mugwump

    Testsuites with SeamTest: Initializing the Microcontainer on

    mugwump

      I have a lot of tests that all roughly follow the same pattern:

      - SeamTest initializes the embedded container
      - set up a faces-request
      - get an instance of a properly prepared seam component
      - run some tests&assertions

      e.g:

      @Test
      public void testCombinedQuery() throws Exception{
       new FacesRequest() {
       QueryManager queryManager;
       @Override
       protected void updateModelValues()
       {
       queryManager = (QueryManager)getInstance("queryManager");
      
       }
      
       @Override
       protected void renderResponse()
       {
       Query query = new Query();
       query.setDays("'DAY1', 'DAY2'");
       query.setTopics("'1','3'");
       int resultSize = queryManager.getNrOfQuestionsInQuery(query);
       assertEquals("Combined-Query did not return the correct Number of Questions", resultSize, COMBINEDQUERY_QUESTIONS);
       }
       }.run();
      }
      


      Now the next test runs through the whole cycle again, including initialization, which takes ages, as it also contains the hibernate-setup with a whole bunch of tables - is there a way to run tests inside a suite on the same container and somehow share the same instance between tests?!

      I would really like to run a whole lot of tests also during development, but this startup-issue is really annoying...

      cheers
      stf