Hi Martin, Please have a look at the FAQ entry: http://junit.sourceforge.net/doc/faq/faq.htm#running_8
To answer your question: - it is not an anomaly of JUnit. It is by design :-) - you can use commons-logging with any JUnit Test Runner (simply put it in the excluded list) - I believe it is the same with the AWT Runner as the JUnit FAQ says "GUI Runners". If you want to be sure, you'll need to check the sources... ;-) -Vincent > -----Original Message----- > From: Martin [mailto:[EMAIL PROTECTED]] > Sent: 02 September 2002 15:41 > To: Cactus Users List > Subject: Re: Cactus test case problem > > Hello Vincent- > Is this anomaly specific to Swing > What about AWT Could we use commons-logging with AWT > or should AWT implementations exclude commons-logging as with Swing? > Many Thanks, > -Martin > > ----- Original Message ----- > From: "Vincent Massol" <[EMAIL PROTECTED]> > To: "'Cactus Users List'" <[EMAIL PROTECTED]> > Cc: "'Martin'" <[EMAIL PROTECTED]> > Sent: Saturday, February 01, 2003 4:48 AM > Subject: RE: Cactus test case problem > > > > Hi Martin, > > > > I think I know what the error is (see > > http://jakarta.apache.org/cactus/faq.html#faq8). It has to do with the > > fact that Kumar is using the Swing Test Runner and this later is using a > > reloadable class runner that has classloading issues with > > commons-logging. Thus commons-logging needs to be excluded from that > > loader. > > > > Thanks for your help! > > -Vincent > > > > > -----Original Message----- > > > From: Martin [mailto:[EMAIL PROTECTED]] > > > Sent: 02 September 2002 03:26 > > > To: Cactus Users List > > > Cc: [EMAIL PROTECTED] > > > Subject: Re: Cactus test case problem > > > > > > Kumar- > > > Can we see the code for class SophiewebServlet() > > > Something in the constructor is causing your new SophiewebServlet > > > constructor to fail and return a null > > > -Martin > > > > > > ----- Original Message ----- > > > From: "Vincent Massol" <[EMAIL PROTECTED]> > > > To: "'Cactus Users List'" <[EMAIL PROTECTED]> > > > Cc: <[EMAIL PROTECTED]> > > > Sent: Friday, January 31, 2003 4:20 PM > > > Subject: RE: Cactus test case problem > > > > > > > > > > Hi Kumar, > > > > > > > > See the Cactus FAQ: > > > > > > > > http://jakarta.apache.org/cactus/faq.html#faq8 > > > > > > > > -Vincent > > > > > > > > > -----Original Message----- > > > > > From: Kumar, Kiran (MED, TCS) [mailto:[EMAIL PROTECTED]] > > > > > Sent: 29 January 2003 04:21 > > > > > To: 'Cactus Users List' > > > > > Subject: Cactus test case problem > > > > > > > > > > Hi > > > > > I am new to JUnit frame work as such and cactus in particular. I > > have > > > > > installed cactus and set all the class paths correctly. > > > > > But when i run the test class for my servlet it threw me this > > > > exception. > > > > > Can somebody help me out in finding the exact root cause of the > > > > problem. > > > > > > > > > > > > > > > junit.framework.AssertionFailedError: Exception in constructor: > > > > > testDefaultConstructor > > > > > (org.apache.commons.logging.LogConfigurationException: > > > > > java.lang.ClassCastException: > > > > > org.apache.commons.logging.impl.LogFactoryImpl > > > > > at > > > > > > > org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:506) > > > > > at > > > > > > > org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350) > > > > > at > > org.apache.commons.logging.LogFactory.getLog(LogFactory.java:381) > > > > > at > > > > > > > > > > > org.apache.cactus.util.JUnitVersionHelper.around146_getTestCaseName(JUni > > > > > > > tVersionHelper.java;org/apache/cactus/util/log/LogAspect.aj(1k):1170) > > > > > at > > > > > > > > > > > org.apache.cactus.util.JUnitVersionHelper.getTestCaseName(JUnitVersionHe > > > > > lper.java;org/apache/cactus/util/log/LogAspect.aj(1k):103) > > > > > at > > > > org.apache.cactus.AbstractTestCase.<init>(AbstractTestCase.java:124) > > > > > at > > > > > > > > > > > org.apache.cactus.AbstractWebTestCase.<init>(AbstractWebTestCase.java:86 > > > > > ) > > > > > at > > org.apache.cactus.ServletTestCase.<init>(ServletTestCase.java:119) > > > > > at > > > > > > > > > > > com.ge.sophieweb.controler.test.TestSophiewebServlet.<init>(TestSophiewe > > > > > bServlet.java:26) > > > > > at java.lang.reflect.Constructor.newInstance(Native Method) > > > > > at &RE: A question ![]()
cactus-user
<-- Chronological --> <-- Thread --> RE: A question
- From: Vincent Massol
- Subject: RE: A question
- Date: Fri, 31 Jan 2003 12:21:06 -0800
RE: Cactus test case problem
Vincent Massol
Sat, 01 Feb 2003 13:27:56 -0800
Hi Tony, You should have a look at the following FAQ entry: http://jakarta.apache.org/cactus/faq.html#faq4 Cactus is about unit testing and there is no order of execution of the JUnit testXXX() methods (same principle as JUnit). You shouldn't rely on a first call setting up some state. Consequently, Cactus starts a new Session for each test. If you need to set up some object in the session, you can do it either in the setUp() method or at the beginning of your testXXX() method. Note that in Cactus 1.5, I have added a new API called WebRequest.getSessionCookie() which allows you to get a cookie before the test begins as shown below. But this is only to support scenarios where your server side code is testing for "!session.isNew()" which is otherwise, not testable... public void beginCreateSessionCookie(WebRequest theRequest) { HttpSessionCookie sessionCookie = theRequest.getSessionCookie(); theRequest.addCookie(sessionCookie); [...] If you really need to set the session cookie before your test starts (note that I have not found a scenario requiring it apart from the session.isNew one), then you can also save the returned session cookie from your first test (you'll need to order your tests - see the JUnit FAQ for this): [...] public void endVerifyJsessionid(WebResponse theResponse) { sessionCookie = theResponse.getCookieIgnoreCase("jsessionid"); } [...] Hope it helps, -Vincent > -----Original Message----- > From: Bin Yan (Tony) [mailto:[EMAIL PROTECTED]] > Sent: 31 January 2003 15:29 > To: 'Cactus Users List' > Subject: RE: A question > > Hi, Vincent: > > Thank you for the reply. I looked up these samples, > and they both sound resonable for cookies. However, I > guess I didn't make my question very clear. The > problem I am having is that I need to store an object > full of configurations in the session object. And as > far as I know, the session related to one Client is by > Cookie/or URL rewriting to be retrievable by server. I > don't think URL rewriting is something applicable > here. So the JSESSIONID in cookie should be active for > a persistent session object for the next request to > use. > > I tried useing IE or NS to access my 7007 (my cactus > setting) port with the right URL, I can tell there are > JSESSIONID and session is persistent. So I guess the > Server side is okay. But each time the client from > cactus requests, there are no cookies. I can, of > course, add cookies as in the samples you gave me. But > I wonder how I can do it to enable the JSESSIONID > cookie. After all, it seems each request is > 'different' from the server's point of view. Correct > me if I am wrong, I think cactus cookie testing seems > to limit to per test. > > Thanks again for your prompt reply. I am doing the > configurations in other ways now (w/o putting in > session) and I can access DB and do other cactus > testing successfully. I think cactus is generally a > great tool. > > Regards, > > TY > > --- Vincent Massol <[EMAIL PROTECTED]> wrote: > > Hi Tony, > > > > You should look in the sample application packaged > > in the cactus > > distribution. There are tests that demonstrates > > setting and retrieving > > cookies. You can view them with viewcvs at: > > > > > http://cvs.apache.org/viewcvs/jakarta-cactus/sample-servlet/src/test-cac > > tus/share/org/apache/cactus/unit/TestCookie.java > > > > and > > > > > http://cvs.apache.org/viewcvs/jakarta-cactus/sample-servlet/src/test-cac > > > tus/share/org/apache/cactus/sample/TestSampleServlet.java > > > > Hope it helps, > > -Vincent > > > > > -----Original Message----- > > > From: Bin Yan (Tony) [mailto:[EMAIL PROTECTED]] > > > Sent: 30 January 2003 01:06 > > > To: [EMAIL PROTECTED] > > > Subject: A question > > > > > > Hi, All: > > > > > > I have setup using cactus and I have one problem. > > In > > > one of the setUp() method I am trying to get the > > > cookies from request object. But I got none. I > > wonder > > > where I should do some configuration before I can > > get > > > the cookies. Please note I got zero cookies from > > both > > > HTTP requests (as designed by cactus). > > > > > > TIA > > > > > > ===== > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > Tony Yan [EMAIL PROTECTED] > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > __________________________________________________ > > > Do you Yahoo!? > > > Yahoo! Mail Plus - Powerful. Affordable. Sign up > > now. > > > http://mailplus.yahoo.com > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > ===== > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Tony Yan [EMAIL PROTECTED] > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
- Cactus test case problem Kumar, Kiran (MED, TCS)
- Re: Cactus test case problem Martin
- Re: Cactus test case problem Martin
- RE: Cactus test case problem Vincent Massol
- Re: Cactus test case problem Martin
- Vincent Massol

