vmassol     02/02/22 15:36:35

  Modified:    docs/framework/xdocs faq.xml
  Log:
  new faq entry : how do I test chaining of servlets ?
  
  Revision  Changes    Path
  1.4       +41 -1     jakarta-cactus/docs/framework/xdocs/faq.xml
  
  Index: faq.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/docs/framework/xdocs/faq.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- faq.xml   15 Dec 2001 21:09:24 -0000      1.3
  +++ faq.xml   22 Feb 2002 23:36:35 -0000      1.4
  @@ -28,6 +28,10 @@
             <code>java.io.StreamCorruptedException: InputStream does not contain a
             serialized object</code> error. What does it mean ?</jump>
           </li>
  +        <li>
  +          <jump anchor="faq4">How can I test the chaining of several HTTP
  +          requests ?</jump>
  +        </li>
         </ul>
       </s1>
   
  @@ -39,7 +43,8 @@
         </p>
   
   <source><![CDATA[
  -java.lang.ExceptionInInitializerError: java.util.MissingResourceException: Can't 
find bundle for base name cactus, locale en_GB
  +java.lang.ExceptionInInitializerError: java.util.MissingResourceException:
  +  Can't find bundle for base name cactus, locale en_GB
   at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:707)
   at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:679)
   at java.util.ResourceBundle.getBundle(ResourceBundle.java:546)
  @@ -194,6 +199,41 @@
           <p>
             Cactus 1.3 should trap or avoid this exception and provide
             a clearer message about the likely causes.
  +        </p>
  +      </s2>
  +
  +    </s1>
  +
  +    <anchor id="faq4"/>
  +    <s1 title="How can I test the chaining of several HTTP requests ?">
  +
  +      <s2 title="Question">
  +        <p>
  +          Let's imagine that I have one servlet that performs an HTTP redirect
  +          to a JSP page (or to another servlet). How do I test it with Cactus ?
  +        </p>
  +      </s2>
  +      <s2 title="Solution">
  +        <p>
  +          Short answer : you don't !
  +        </p>
  +        <p>
  +          Long answer : Cactus is meant to be a unit testing tool, meaning it
  +          lets you perform tests for a given method and then it lets you
  +          assert the result from that method.
  +        </p>
  +        <p>
  +          In the above scenario, a typical Cactus test will consist in
  +          verifying that the return HTTP response is an HTTP redirect (by
  +          checking the HTTP response code - 302 - in the <code>endXXX()</code>
  +          method) and possibly also checking the URL of the redirect page.
  +        </p>
  +        <p>
  +          Then, as a second test, you could (if you wish) verify that calling
  +          the URL of the JSP does return such HTML content (using HttpUnit
  +          integration for example). Note that this second test is rather a
  +          functional test than a unit test but it can still be viewed as
  +          unit testing the <code>doGet()</code> method of the JSP ...
           </p>
         </s2>
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to