jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vidya Deshmukh" <vid...@bsil.com>
Subject RE: Cactus wth cocoon help.
Date Fri, 27 Sep 2002 05:00:01 GMT

Hi Vincent,
   I want to test an application which uses cocoon framework , for now I am
just accessing the middle page of application and trying to test wheather
session is valid or present for a perticular user or not. But I am not able
to access that page thro' cactus and rather not getting any session object
after accessing that page,

here is my code....

import junit.framework.Test;
import junit.framework.TestSuite;

import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
mport javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletConfig;

public class TestLogin extends ServletTestCase
  public TestLogin(String theName)

  String loginUrl = "/test/admin/index.jsp";
  String logoutUrl = "/test/logout.jsp";
  String errMsgUrl = "/test/index.jsp?error='Please Enter Login and
Password' ";

   * initialize parameters
  public void beginValidateLogin(WebRequest webRequest)
    webRequest.addParameter("username", "aol");
    webRequest.addParameter("password", "secret");

   * test to check wheather session is valid or not and verify that by
   * default the session implicit object is available and can be used.
  public void testValidateLogin() throws ServletException

      //ServletConfig theConfig;
      RequestDispatcher dispatch =
      dispatch.forward(request, response);

      HttpSession session = request.getSession(false);

        // Perform verification that test was successful
    catch (Exception ex)
      System.out.println("Exception" + ex);
      // ex.printStackTrace();
    } // end of catch
  } // end of test method

   * test to check wheather user has successfully logged out.
  public void testLogout() throws ServletException
      RequestDispatcher dispatch =
      dispatch.include(request, response);
    } // end of try
    catch (Exception se)
    } // end of catch

  } // end of test method
  public static Test suite()
    return new TestSuite(TestLogin.class);

Tell me if I am doing anything wrong out here.....

-----Original Message-----
From: Vincent Massol [mailto:vmassol@octo.com]
Sent: Thursday, September 26, 2002 3:20 AM
To: 'Cactus Users List'
Subject: RE: Cactus wth cocoon help.

Hi Vidya,

Short answer is yes. What do you want to unit test from Cocoon?


> -----Original Message-----
> From: Vidya Deshmukh [mailto:vidyad@bsil.com]
> Sent: 25 September 2002 06:14
> To: cactus-user@jakarta.apache.org
> Subject: Cactus wth cocoon help.
> Hi!
>    Can anyone tell me wheater it is possible to Write test cases for
> cocoon
> framework? I am trying for it but getting some error while using
> requestDispatcher object, and not able to acces jsp pages and not
> any request or response or session object from any jsp page.
> Regards,
> Vidya
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message