1 Reply Latest reply on Mar 11, 2008 2:40 PM by Alok Kumar

    Seam Integration Test failing new FacesRequest(){}

    Alok Kumar Newbie

      i am trying to use SeamTest for integration testing. what I am able to run Unit test cases. When I am trying to run Integration test cases then I am ending up in problem. This is the code snippet which I am trying to run in my test case :

      @Test( alwaysRun=true )
      public void testLoginPage() throws Exception
      {
      new FacesRequest("/security/login.xhtml")
      {
      @Override
      protected void updateModelValues() throws Exception
      {
      System.out.println("helkjfskljdfsafdasfkhkajsfd");
      assert "helo".equals( "helo" );
      }
      }.run();
      }

      When I am running this test case then this is the exception I am getting. I am not able to understand why is that :

      [testng] FAILED: testLoginPage
      [testng] javax.servlet.ServletException: ServletContext not allow to getResourceAsStream for /WEB-INF/web.xml
      [testng] at org.ajax4jsf.framework.util.config.WebXml.(WebXml.java:104)
      [testng] at org.ajax4jsf.framework.resource.ResourceBuilderImpl.init(ResourceBuilderImpl.java:183)
      [testng] at org.ajax4jsf.framework.resource.InternetResourceService.init(InternetResourceService.java:96)
      [testng] at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.getResourceService(BaseFilter.java:278)
      [testng] at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:207)
      [testng] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      [testng] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      [testng] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      [testng] at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:514)
      [testng] at com.subexazure.spark.web.app.model.security.LoginTest.testLoginPage(LoginTest.java:11)
      [testng] ... Removed 22 stack frames

      What can I do to avoid this.

        • 1. Re: Seam Integration Test failing new FacesRequest(){}
          Alok Kumar Newbie

          do i have to exclude any other jar from the classpath. I saw in couple of example ant scripts with seam/example, some seam jars were excluded from the test classpath, calling it as jboss-embedded hack. Do I have to do that. Though just to make a point I am not using EJB in my applcation. I am using normal SEAM pojos.

          Also when I see the console I see all the SEAM components being loaded on startup but when I trying accessing them using

          Components.getInstance(xyz.class, ScopeType.CONVERSATION);

          It says there is no Conversation context present. Do I have to anything for that.

          Also for all the test classes I am writing extending from SeamTest loads the Seam environment loading all the Components all over again. Is there any way to avoid that ?