From: Paul B. <pa...@em...> - 2003-02-26 15:44:47
|
Hi there - Thanks for the great work on HTML-Unit, this is truly an exceptional software library. I was just trying it out for the first time, and trying to make it login to the web site I am developing. However, it doesnt look like cookies are supported in the WebClient class - is this true, or have I missed something? The pages I am testing rely almost completely on a session cookie in the browser, so it just keeps giving me back the login screen even after I have submitted the form. Any help would be greatly appreciated. -Paul |
From: Mike B. <mb...@Ga...> - 2003-02-26 16:03:49
|
> However, it doesnt look > like cookies are supported in the WebClient class - is this true, or > have I missed something? The pages I am testing rely almost > completely on a session cookie in the browser, so it just keeps giving > me back the login screen even after I have submitted the form. Any cookies sent down from the server will be returned on the next request so session cookies should certainly be working. What version of HtmlUnit are you using? The cookie support is actually provided by commons-httpclient so you might want to try using a newer version of that - "alpha3" is the latest release. http://www.ibiblio.org/maven/commons-httpclient/jars/ There have been a number of problems reported that seem to be a problem with the version of commons-httpclient that I bundled with HtmlUnit 1.1. So far all of these have been fixed in the more recent builds of commons-httpclient. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Paul B. <pa...@em...> - 2003-02-26 17:09:07
|
> -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of Mike > Bowler > Sent: Wednesday, February 26, 2003 8:00 AM > To: htm...@li... > Subject: Re: [HtmlUnit] Cookie support? > > > > However, it doesnt look > > like cookies are supported in the WebClient class - is this true, or > > have I missed something? The pages I am testing rely almost > > completely on a session cookie in the browser, so it just keeps giving > > me back the login screen even after I have submitted the form. > > Any cookies sent down from the server will be returned on the next > request so session cookies should certainly be working. > > What version of HtmlUnit are you using? HtmlUnit 1.1 > The cookie support is actually provided by commons-httpclient so you > might want to try using a newer version of that - "alpha3" is the latest > release. > > http://www.ibiblio.org/maven/commons-httpclient/jars/ > > There have been a number of problems reported that seem to be a problem > with the version of commons-httpclient that I bundled with HtmlUnit 1.1. > So far all of these have been fixed in the more recent builds of > commons-httpclient. After I downloaded and replaced that JAR, everything works fine! Thank you so much! -Paul |
From: Paul B. <pa...@em...> - 2003-02-27 15:31:16
|
Hi there - I was wondering if anyone has any example code for how to set up TestCases and how to run TestSuites using HTML-Unit. Usually, in other testing X-Unit testing frameworks, you do something like: class MyTestCase extends TestCase { public void testMyTest1() { if (errorCheckFails) { this.fail("test failed"); } } public static void main() { TestSuite suite = new TestSuite(); suite.add(new MyTestCase()); suite.run(); } } But I havent found any example code on the web page for doing this...anyone care to post a snippet to the list? Also, is there any web or GUI interface for HTML-Unit so you can click on a "Run" button and see pretty green lights when everything works? -Paul |
From: Mike B. <mb...@Ga...> - 2003-02-27 15:53:40
|
> I was wondering if anyone has any example code for how to set up > TestCases and how to run TestSuites using HTML-Unit. Usually, in > other testing X-Unit testing frameworks, you do something like: Perhaps the word "Unit" in HtmlUnit is confusing the issue. This isn't a generic unit testing framework like JUnit. It's a tool that lets you access your web application and interact with it. You still need something like JUnit to write your tests in. Within those tests, you can use HtmlUnit to access your web application. Does this help? -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |