WebConversation wc = new WebConversation();
WebResponse resp = wc.getResponse( "http://www.cnet.com" ); // read this page
resp = wc.getCurrentPage();
You can try to see resp.String (i forgot how i looked into resp value).
i hope it helps.
-S
On 12/21/05, rt d <[EMAIL PROTECTED]
> wrote:
Hi Sayeem,Thank you for your reply.Please look into attached file for complete code listingRavi
Sayeem Ahmed < [EMAIL PROTECTED]> wrote:pl send your full relevant code starting from 'import' declaration.
On 12/21/05, rt d <[EMAIL PROTECTED] > wrote:Hi ,Can you take a look at forwarded message becasue I'm really stuck at that point.I appreciate you timeRavi
Note: forwarded message attached.__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------- Forwarded message ----------
From: rt d <[EMAIL PROTECTED] >
To: [email protected]
Date: Wed, 21 Dec 2005 09:47:09 -0800 (PST)
Subject: Re: [Jwebunit-users] jwebunit: Runtime exception for beginAt("/")
When I try to run following test (Run as jWebUnit from Eclipse), I'm receiving this error :junit.framework.AssertionFailedError : No tests found in net.sourceforge.jwebunit.WebTestCase
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestSuite$1.runTest(TestSuite.java :263)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected (TestResult.java:124)
at junit.framework.TestResult.run (TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run (TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:196)
rt d < [EMAIL PROTECTED]> wrote:Hi All,I'm novice to jwebunit and trying to follow the directions provided in this web site jwebunit.sourceforge.net/I have copied all necesary lib files and configured the eclipse IDE to run the test. I'm getting runtime exception at begining of program at beginAt("/) method.Code I'm dealing with is :import net.sourceforge.jwebunit.*;public class TestSearch extends WebTestCase {
public TestSearch(String name){
super(name);&nbs p;public void setUp()throws Exception {
System.out.println("in setUp()");getTestContext().setBaseUrl(" http://www.cnet.com");}public void testFirstPage() {
System.out.println("in testFirstPage()");
// beginAt("/2001-1_7-0.html");
beginAt("/");}}As soon as I run this, getting following runtimeexception. Has some one expericed this before? Your comments would be highly appreciated.java.lang.RuntimeException : java.io.EOFException
at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:200)
at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:190)
at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java :130)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58)
a t java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:68)
at com.meterware.httpunit.WebResponse.defineRawInputStream(WebResponse.java:739)
at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java :57)
at com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:61)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:162)
at com.meterware.httpunit.WebWindow.getSubframeResponse( WebWindow.java :125)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:118)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:112)
at net.sourceforge.jwebunit.HttpUnitDialog.<init>( HttpUnitDialog.java :48)
at net.sourceforge.jwebunit.WebTester.beginAt(WebTester.java:55)
at net.sourceforge.jwebunit.WebTestCase.beginAt(WebTestCase.java:46)
at com.TestSearch.testDownloadLink(TestSearch.java :63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect (TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest (TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)at net.sourceforge.jwebunit.HttpUnitDialog .<init>(HttpUnitDialog.java:50)
at net.sourceforge.jwebunit.WebTester.beginAt(WebTester.java:55)
at net.sourceforge.jwebunit.WebTestCase.beginAt(WebTestCase.java:46)
at com.TestSearch.testDownloadLink(TestSearch.java :63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run (TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java :478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
package com;
import com.meterware.httpunit.ClientProperties;
import com.meterware.httpunit.WebClient;
import net.sourceforge.jwebunit.*;
// Created TestSearch Class
public class TestSearch extends WebTestCase {
public TestSearch(String name){
super(name);
System.out.println("in ctor");
}
static String searchLink = "ipod";
// Get Client to perform computation and set base url for application under test
public void setUp()throws Exception {
//System.out.println("in setUp()");
WebClient client = getTestContext().getWebClient();
ClientProperties props = client.getClientProperties();
props.setAcceptGzip(true);
getTestContext().setWebClient(client);
getTestContext().setBaseUrl(" http://www.cnet.com");
//getTestContext().setProxyName(" reviews.ssaqa.cnet.com");
//getTestContext().setProxyPort(8001);
}
// Create test cases to test main page
public void testFirstPage() {
System.out.println("in testFirstPage()");
beginAt("/2001-1_7-0.html");
//beginAt("/");
}
public void testSearchString(){
System.out.println("In Final method");
beginAt("/2001-1_7-0.html");
assertFormElementPresent("lsearch");
setFormElement("lsearch", "ipod");
submit("search_go");
assertLinkPresentWithText("Apple iPod Nano (4GB, black)");
clickLinkWithText("Apple iPod Nano (4GB, black)");
}
}
--
Regards,
Sayeem
Ph: 408 480-6760
