Re: Test com.meterware.httpunit.cookies.CookieTest.testCookieAge failing
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Wolfgang,
Sorry for the delayed response. I started a new job last week and have
been a little preoccupied. At any rate I just checked-out from SVN the
httpunit trunk and ran the unit tests clean. Attached is the one and
only test failure from CookieTest.
As for my environment I was running Vista (32bit) with JDK 1.6 (1.6.0_07
I believe) and Maven 2.0.9.
My current platform is an XP Professional installation running on VMWare
on Vista 64-bit also with JDK 1.6.0_07 and Maven 2.0.9. Nekohtml 0.9.5
is in my ~/.m2/repository so I assume that's what's being used for that.
Let me know if I can be of any further help.
Thanks!
Jamey
Wolfgang Fahl - BITPlan wrote:
> James,
>
> you wrote:
> > This is tricky to test as getting an exact time match is tough.
> > Additionally it appears that for the 3rd and 4th elements in the test
> data
> > array that the code interpreting the cookie expiration times is giving
> > priority to the Max-Age value over the expires value. The test code
> appears
> > to be expecting the expires value to be the value used so maybe the
> cookie
> > interpretation library changed at some point else this test would always
> > have failed.
> Thank you fro looking into this an proposing a solution how to fix the
> tests. I'll happily add your proposed changes. I'm assuming the
> CookieTest.java testCookieAge() test case fails in your environment
> with the latest svn head version of httpunit.
> Since it doesn't fail in my environment I'd like to first find out
> what the difference between our environment is that leads to this
> difference in behaviour.
>
> I'm testing on a Windows XP machine with JDK 1.5 in an Eclipse
> environment with the settings as commited to the subversion
> respository e.g. I'm working with Nekohtml 0.9.5 as configured in the
> maven settings.
>
> Yours
> Wolfgang
>
> >
> >
> > Below are the changes I made to CookieTest.java to get the testCookieAge
> > test to succeed.
> >
> >
> >
> > Jamey
> >
> >
> >
> > @@ -182,11 +185,14 @@
> >
> > "expires=Tue, 29-Mar-2005 19:30:42 GMT",
> >
> > "Expires=Wednesday, 01-Jan-1970 0:0:00 GMT"
> >
> > };
> >
> > - long expectedMilliSeconds[] = {System.currentTimeMillis() +
> 5000 *
> > 1000,
> >
> > - System.currentTimeMillis() +
> 3000 *
> > 1000,
> >
> > + long now = System.currentTimeMillis();
> >
> > + long expectedMilliSeconds[] = {now + 5000 * 1000,
> >
> > + now + 3000 * 1000,
> >
> > + //1112124642000l,
> >
> > + now + 2592000 * 1000,
> >
> > + //1112124642000l,
> >
> > + now + 2592000 * 1000,
> >
> > 1112124642000l,
> >
> > - 1112124642000l,
> >
> > - 1112124642000l,
> >
> > 0};
> >
> >
> >
> > for (int i = 0; i < ages.length; i++) {
> >
> > @@ -199,7 +205,7 @@
> >
> > assertNotNull( cookieName + " not null", cookie );
> >
> >
> >
> > long expiredTime = cookie.getExpiredTime();
> >
> > - assertEquals( cookieName + " expiration", expiredTime,
> > expectedMilliSeconds[i] );
> >
> > + assertTrue( cookieName + " expiration",
> Math.abs(expiredTime -
> > expectedMilliSeconds[i]) < 50 );
> >
> > }
> >
> > }
> >
> >
>
>
> *
> *
> *BITPlan* - smart solutions
> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
> Tel. +49 2154 811-480, Fax +49 2154 811-481
> Web: http://www.bitplan.de
> bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548,
> Geschäftsführer: Wolfgang Fahl
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop
com.meterware.httpunit.cookies.CookieTest.txt
(text/plain, 799 B)
------------------------------------------------------------------------------- Test set: com.meterware.httpunit.cookies.CookieTest ------------------------------------------------------------------------------- Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.063 sec <<< FAILURE! testCookieAge(com.meterware.httpunit.cookies.CookieTest) Time elapsed: 0 sec <<< FAILURE! junit.framework.AssertionFailedError: cookie2 expiration expected:<1221225899500> but was:<1112124642000> at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.failNotEquals(Assert.java:282) at junit.framework.Assert.assertEquals(Assert.java:64) at junit.framework.Assert.assertEquals(Assert.java:136) at com.meterware.httpunit.cookies.CookieTest.testCookieAge(CookieTest.java:202)