You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Denis Avdic <de...@betterway.net> on 2003/10/17 21:33:48 UTC

changes in state between beginXXX and testXXX

Hello,

I am trying to test cookie login on my site.  However I cannot find any
cookies in my test method.

Here is my code snippet:
public void beginLoginCookie (WebRequest wr){


wr.addCookie("www.domain.com:80",ServletUtils.COOKIE_NAME,"myvalue");
        wr.setURL("www.domain.com:80", "", "/login.html", null,null);
        dBSnapshot();
        ServletUtils.log("after snapshot");
    }

public void testLoginCookie() throws Exception{

        controller.doGet(request,response);

}

My controller servlet cannot find anything in the request.

Does the request reset after begin method?   Should I put the cookie
directly into the request in the testLoginCookie() method?

Denis


RE: Question about Servlet TestSuite

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Bret Kumler [mailto:bkumler@firstam.com]
> Sent: 17 October 2003 22:55
> To: Cactus Users List
> Subject: Question about Servlet TestSuite
> 
> I have the following script
> 
> package com.test;
> 
> import junit.framework.*;
> import org.apache.log4j.Logger;
> 
> 
> 
> public class AllBatTests{
> 
> 
>   private static Logger logger = Logger.getLogger(AllBatTests.class);
> 
> 
>   public static Test suite() {
>     TestSuite suite = new TestSuite();
>     suite.addTest(com.test.QaServiceBatTest.suite());
>     suite.addTest(com.test.QaProductBatTest.suite());
>     return suite;
>   }
> }
> 
> If I change it to
> 
> public static Test suite() {
>     ServletTestSuite suite = new ServletTestSuite ();
>     suite.addTest(com.test.QaServiceBatTest.suite());
>     suite.addTest(com.test.QaProductBatTest.suite());
>     return suite;
> }
> 
> Can I still use JUnit to run the test or do I need seperate test
suites?

I don't understand. What you have written *is* a test suite. As with all
cactus tests you need to use a JUnit test runner to start the test.

-Vincent


RE: Question about Servlet TestSuite

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Bret Kumler [mailto:bkumler@firstam.com]
> Sent: 17 October 2003 22:55
> To: Cactus Users List
> Subject: Question about Servlet TestSuite
> 
> I have the following script
> 
> package com.test;
> 
> import junit.framework.*;
> import org.apache.log4j.Logger;
> 
> 
> 
> public class AllBatTests{
> 
> 
>   private static Logger logger = Logger.getLogger(AllBatTests.class);
> 
> 
>   public static Test suite() {
>     TestSuite suite = new TestSuite();
>     suite.addTest(com.test.QaServiceBatTest.suite());
>     suite.addTest(com.test.QaProductBatTest.suite());
>     return suite;
>   }
> }
> 
> If I change it to
> 
> public static Test suite() {
>     ServletTestSuite suite = new ServletTestSuite ();
>     suite.addTest(com.test.QaServiceBatTest.suite());
>     suite.addTest(com.test.QaProductBatTest.suite());
>     return suite;
> }
> 
> Can I still use JUnit to run the test or do I need seperate test
suites?

I don't understand. What you have written *is* a test suite. As with all
cactus tests you need to use a JUnit test runner to start the test.

-Vincent


Question about Servlet TestSuite

Posted by Bret Kumler <bk...@firstam.com>.
I have the following script

package com.test;

import junit.framework.*;
import org.apache.log4j.Logger;



public class AllBatTests{


  private static Logger logger = Logger.getLogger(AllBatTests.class);

  
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(com.test.QaServiceBatTest.suite());
    suite.addTest(com.test.QaProductBatTest.suite());
    return suite;
  }
}

If I change it to 

public static Test suite() {
    ServletTestSuite suite = new ServletTestSuite ();
    suite.addTest(com.test.QaServiceBatTest.suite());
    suite.addTest(com.test.QaProductBatTest.suite());
    return suite;
}

Can I still use JUnit to run the test or do I need seperate test suites?


Thanks