2 Replies Latest reply on Dec 26, 2007 8:33 AM by thesid

    Reg:Working out JSFUnit with Eclipse

    pa1_9

      Hi everyone,
      i have a set of doubts regarding JSFUnit with Eclipse

      1.
      i was not able to run my testcase from eclipse....... i have configured tomcat as my server in eclipse and am trying to run it from the server......but unable to suceed


      becoz of the following error........

      HTTP Status 500 -
      
      --------------------------------------------------------------------------------
      
      type Exception report
      
      message
      
      description The server encountered an internal error () that prevented it from fulfilling this request.
      
      exception
      
      org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 12
      
      9: <title>index page</title>
      10: </head>
      11: <body>
      12: <f:view>
      13: <h:form id="form1">
      14: <h:outputText value="Enter your name:" rendered="#{!empty foo.text}" id="prompt"/>
      15: <h:outputText value="Hello #{foo.text}" rendered="#{!empty foo.text}" id="greeting"/>
      
      
      Stacktrace:
       org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      
      
      root cause
      
      javax.faces.FacesException: Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml configuration fileand if you are accessing your jsf-pages through the correct mapping. E.g.: if your FacesServlet is mapped to *.jsf (with the <servlet-mapping>-element), you need to access your pages as 'sample.jsf'. If you tried to access 'sample.jsp', you'd get this error-message.
       javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:926)
       javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:313)
       org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:73)
       org.apache.jsp.index_jsp._jspx_meth_f_005fview_005f0(index_jsp.java:110)
       org.apache.jsp.index_jsp._jspService(index_jsp.java:85)
       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      
      
      note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
      
      

      --------------------------------------------------------------------------------

      Apache Tomcat/6.0.14





      but the same thing ...if i create a war file and paste it in webapps of tomcat
      i was able to run it..........

      2.
      do i need to give the full url like
      http://localhost:8080/jsfunit/ServletTestRunner?suite=com.foo.JSFUnitTest&xsl=cactus-report.xsl


      is there any other way in eclipse if i say run from the server ..then directly my testcase should execute........



      3.

      when i paste this cactus-report.xsl into my root directory in eclipse and when i create a war file this file in not included...again i need to explicitly include this file and then paste the war file in webapps of tomcat.....




      can anybody help me out in these issues.........



        • 1. Re: Reg:Working out JSFUnit with Eclipse

          the JSFClientSession has tobe initialised with the JSF page, hence index.jsf or index.faces - depending on your web.xml settings.

          Next, make sure that you have the required faces libraries in the web-inf lib directory and the correct settings in the web.xml to initalize jsf.

          Hence the first step is to call the website manually, trace down all errors occuring, and then using the same url that was used for manual call for the JSFUnitClientSession ...

          Then it should work.

          • 2. Re: Reg:Working out JSFUnit with Eclipse

            Ah - forget my post *sighs* i guess I was too tired still.

            There's a way to run the testcases right within eclipse (i think, as i do the same with idea).

            You can right click on the classname and say "debug" or "run", and it should execute too.

            Or you could aswell call those testcases from within your normal classes, by calling the static method, creating a testresult, and calling the "run" method on the suite and passing the testresult object to it.

            Then you can analyse the testresult object to see if there was any failures.

            What you could maybe try too is creating the jar file yourself, with the "tomcat profile" - maybe that helps too.