Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
11. Mar 2008, 14:06 CET | Link

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.<init>(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.

4 Replies:
11. Mar 2008, 14:29 CET | Link

Make sure that the richfaces-impl.jar isn't on the test classpath iirc.

 

Read about how to report a bug.

11. Mar 2008, 18:49 CET | Link

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 ?

11. Mar 2008, 21:34 CET | Link

Take a look at what seam-gen generates, it is correct.

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 ?

This is redesigned in Seam 2.1

 

Read about how to report a bug.

12. Mar 2008, 13:43 CET | Link

richfaces-impl.jar is not there

I am not using EJB anywhere and I am deploying my application on tomcat. I dont have the Scopes (session, conversation) available and even I dont have the FacesContext available. One of my class looks for:

@In (create=true)
private FacesContext facesContext

It returns facesCOntext as null

Do we have a documentation which i can follow for configuring test framework for my application.