1 2 Previous Next 22 Replies Latest reply on Oct 5, 2010 8:49 PM by kragoth Go to original post
      • 15. Re: Testing a4j with JSFUnit
        marti

        This is the error i get when i try to run the test.

         

        500 Internal Server Error for http://localhost:8080/guessNumber/pages/ajaxTest.jsp
        
        com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Internal Server Error for http://localhost:8080/guessNumber/pages/ajaxTest.jsp
        at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:530)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:330)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371)
        at org.jboss.jsfunit.framework.SimpleInitialRequestStrategy.doInitialRequest(SimpleInitialRequestStrategy.java:48)
        at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:260)
        at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:81)
        at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:58)
        at test.AjaxTestPage.setUp(AjaxTestPage.java:31)
        at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
        at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
        at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
        at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
        at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
        at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
        at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
        at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
        at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:46)
        at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
        at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
        at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
        at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Unknown Source)

         

         

        the error in last post is occuring when i try to connect the ajaxTest.jsp page.

        • 16. Re: Testing a4j with JSFUnit
          kragoth

          You can't just remove the jboss-seam.jar. This test relies on Seam. The EL expressions in the xhtml rely on the fact that the Seam bean is able to be found by following the expression #{AjaxTest.[attribute]}. So by removing the seam lib there is no possible way for the test to run.

           

          Now, with regards to your 500 error. You've modified my code a little bit though cause line 31 is blank in my code so I need you to post your full AjaxTestPage.java code here so I can see what line 31 is.

          • 17. Re: Testing a4j with JSFUnit
            kragoth

            Another thing. Can you manually navigate to this page via the browswer and does it work properly for you?

            • 18. Re: Testing a4j with JSFUnit
              marti

              I'm working inside guessNumber project.  i created those file there. ( is it ok? )

              then when i add seam.jar to lib the project crashes... and i cant test ant of my test classes.

              no i can not navigate to that page manually.

              what is the extension for ajaxTest file? is it .jsp or .jsf or .xhtml

              • 19. Re: Testing a4j with JSFUnit
                kragoth

                I wrote the test to be put with your actual applications source not the guessNumber example app. The guessNumber example is pure JSF without Seam. In order to run it in that environment you would need to do some more work by mapping the bean manually. The extension would be whatever your app has been set up to work with.

                 

                The problems you are having are testing your own app not the guessNumber app. The point of this test is to determine if ajax is working in your actually testing environment not the guessNumber example. Put the test into your actual app and use whatever extension the rest of your project uses. This way you'll actually be testing in the environment you are having the issues.

                • 20. Re: Testing a4j with JSFUnit
                  marti

                  To get any changes happened to rendered html (in this case caused by ajax) get the current page and refresh it.

                   

                  HtmlPage currPage = (HtmlPage) client.getContentPage()

                  currPage.refresh();

                   

                  in this way you should get updates happened to page.

                  • 21. Re: Testing a4j with JSFUnit
                    kragoth

                    I disagree that this is the correct answer. I'm sorry but it is purely a work around. None of my ajax pages require this to work and the example I posted does not require this either.

                     

                    What you have given is a work around and ultimately there is something else happening in your code that is stopping this from working.

                     

                    I know that you may not have the time to research the real reason for your problem but your solution should be considered a work around only. If you do eventually get some time to research this then I would recommend simplifying the test to the point where it works and then slowly adding features back into the page until you find the point of failure. Once you have found this it should be easy to then write a nice simple test that reproduces the problem. Then with the help of Stan I'm sure we could come up with a proper solution.

                     

                    At the end of the day your JSFUnit tests should be written as if the client is the browser itself. Calls to refresh are not a true representation of how your application runs and thus it would be good to solve the problem properly.

                     

                    That being said, I know the example I posted on my blog was not using the latest version of all the libraries used in JSFUnit testing. Upgrading to the latest versions may infact fix the problem. Unfortunately (and Stan I need to talk to you about this one day ) I have never been able to get JSFUnit to work with the versions of the libraries posted in the doco. I'm still using jboss-jsfunit-xxx-1.1.0.GA-SNAPSHOT.jar to keep my tests running. I would like to upgrade to the new version as it fixes some of the issues I have worked around up till now. So, maybe if I have a couple of productive days and get a few hours of spare time I'll try upgrade again and then maybe see if we can update the doco to reflect a compatible list of libs.

                    • 22. Re: Testing a4j with JSFUnit
                      kragoth

                      Following up what I just said I think I may have found a possible area that could cause these problems.

                       

                      https://jira.jboss.org/browse/JSFUNIT-236

                       

                      That defect may be playing a roll in this problem. I really would like to test it out myself but I *REALLY* need to get some of my own work done today.

                       

                      The problem with this type of defect is that a simple test may not always prove the problem. Sometimes the timing can be what causes the problem and thus a small test may not reproduce the error. Anyway, something to think about.

                      1 2 Previous Next