I believe HTTP 302 status is a client side redirect ... so you have two options:

Option one: do server side redirect so in request-response you'll get you error page as response.

Option two: Client side redirect works like this: Servlet respond contains HTTP status 302 and page to be redirected to. Client browser recognizes this response and redirects to your error page.
So this option is to amalyze that HTTP 302 response is correct and you can analyze HTTP header to check that client will be redirected to correct erro page.




Pete McKinstry <[EMAIL PROTECTED]>

10/17/2001 01:52 PM
Please respond to cactus-user

       
        To:        cactus-user list <[EMAIL PROTECTED]>
        cc:        
        Subject:        testing redirects



Hello-

I'm just getting started w/ Cactus. I have gotten a
few servlet/jsp tests working, so i think i've got
everything setup right.

My current question has to do w/ servlet redirects.
I'd like to test that my servlet is correctly
redirecting to the error page if the wrong parameters
are passed in the request. So I do this:

public void testCreateWithNoParams() throws Exception
{
 CreateWorkflowServlet servlet = new
CreateWorkflowServlet();
 servlet.service(request, response);
}

public void endCreateWithNoParams(WebResponse resp)
throws Exception {
 String text = resp.getText();
 System.out.println("response page = " + text );
 // do some asserts on the page text to check that
 // it's the error page.
}

When i run it, i'm getting a 302 error page back, but
what I want is the page after that. What am i doing
wrong? (i'm using tomcat 4.0 if that makes a
difference.)

Thanks a lot for any tips.

-pgm


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com


Reply via email to