Have you LoginWebTest extend JspTestCase instead of
ServletTestCase.
--- "White, Melissa" <[EMAIL PROTECTED]> wrote:
> I am trying to use Cactus to unit test our JSPs, but
> am having difficulty
> getting a simple test to work. I have a test case
> defined as follows:
>
> public class LoginWebTest extends ServletTestCase
> {
> private static Cookie jsessionid = null;
>
> public LoginWebTest(String name)
> {
> super(name);
> }
>
> public static void main(String[] args)
> {
> junit.textui.TestRunner.run(suite());
> }
>
> public static Test suite()
> {
> final TestSuite suite = new TestSuite();
> suite.addTest(new
> LoginWebTest("testGetJsessionid"));
> suite.addTest(new LoginWebTest("testLogin"));
> return suite;
> }
> public void beginGetJsessionid(WebRequest
> webRequest)
> {
> webRequest.setURL("localhost:8101", "",
> "/portal/login.jsp", null,
> null);
> }
>
> public void testGetJsessionid() {}
>
> public void endGetJsessionid(WebResponse
> webResponse)
> {
> Cookie c =
> webResponse.getCookieIgnoreCase("jsessionid");
> assertNotNull(c);
> this.jsessionid = c;
> }
>
> public void beginLogin(WebRequest webRequest)
> {
> webRequest.setURL("localhost:8101", "",
> "/portal/doLogin.jsp", null,
> null);
> webRequest.addParameter("company", "mwhite");
> webRequest.addParameter("username", "admin");
> webRequest.addParameter("password", "adminpwd");
> }
>
> public void testLogin()
> {
> assertEquals("mwhite",
> request.getParameter("company"));
> SpecialistValue sv =
>
(SpecialistValue)session.getAttribute(SpecialistKeys.CURRENT);
> assertNotNull("SpecialistValue not found in
> session", sv);
> }
> }
>
> The assertNotNull in testLogin fails, but it is not
> clear to me that
> doLogin.jsp is ever being reached. If it is, there
> should be some output in
> my JRun log, but there is none. After doLogin.jsp is
> executed, I should be
> able to retrieve the SpecialistValue object from the
> session. Am I missing
> something?
>
> I'm using JRun 3.1. Any help would be greatly
> appreciated.
>
> -- Melissa
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]