dcsimg
Getting java.net.UnknownHostException: http://www.google.com/
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chandra_Kanth
Posted On:   Friday, November 11, 2005 10:55 AM

hi, i am doing automation testing practice. i copied code from net like this. public class GoogleTest extends WebTestCase { static String searchLink=""; public static void main(String[] args){ searchLink=args[0]; junit.textui.TestRunner.run(new TestSuite(GoogleTest.class)); } public void setUp(){ getTestContext().setBaseUrl("http://www.google.com"); //getTestContext().setProxyName("proxyname"); // getTestContext().setProxyPort(80); } public void testSearch(){ beginAt("/"); assertFormElementPresent("q"); setFormElement("q","HttpUnit"); submit   More>>

hi,

i am doing automation testing practice. i copied code from net like this.

public class GoogleTest extends WebTestCase {
static String searchLink="";
public static void main(String[] args){
searchLink=args[0];
junit.textui.TestRunner.run(new TestSuite(GoogleTest.class));
}
public void setUp(){
getTestContext().setBaseUrl("http://www.google.com");
//getTestContext().setProxyName("proxyname");

// getTestContext().setProxyPort(80);

}
public void testSearch(){
beginAt("/");
assertFormElementPresent("q");
setFormElement("q","HttpUnit");
submit("btng");
assertLinkPresentWithText(searchLink);
clickLinkWithText(searchLink);
}
}

but i am getting the following error.


java.lang.RuntimeException: java.net.UnknownHostException: http://www.google.com/
at com.meterware.httpunit.HttpWebResponse.readResponseHeader(HttpWebResponse.java:150)
at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:185)
at com.meterware.httpunit.HttpWebResponse. (HttpWebResponse.java:53)
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. (HttpUnitDialog.java:48)
at net.sourceforge.jwebunit.WebTester.beginAt(WebTester.java:55)
at net.sourceforge.jwebunit.WebTestCase.beginAt(WebTestCase.java:46)
at GoogleTest.testSearch(GoogleTest.java:27)
at java.lang.reflect.Method.invoke(Native Method)
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 junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
at java.lang.reflect.Method.invoke(Native Method)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
java.lang.RuntimeException: java.net.UnknownHostException: http://www.google.com/
at com.meterware.httpunit.HttpWebResponse.readResponseHeader(HttpWebResponse.java:150)
at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:185)
at com.meterware.httpunit.HttpWebResponse. (HttpWebResponse.java:53)
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. (HttpUnitDialog.java:48)
at net.sourceforge.jwebunit.WebTester.beginAt(WebTester.java:55)
at net.sourceforge.jwebunit.WebTestCase.beginAt(WebTestCase.java:46)
at GoogleTest.testSearch(GoogleTest.java:27)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)

at net.sourceforge.jwebunit.HttpUnitDialog. (HttpUnitDialog.java:50)
at net.sourceforge.jwebunit.WebTester.beginAt(WebTester.java:55)
at net.sourceforge.jwebunit.WebTestCase.beginAt(WebTestCase.java:46)
at GoogleTest.testSearch(GoogleTest.java:27)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)


what is the problem.i am supposing to give proxyname is wrong.can i give proxy ip address.

i have given proxy address then also i am getting the same error.


if anybody help me i will be thankful to them.pls reply to pc.kanth@gmail.com.

   <<Less
About | Sitemap | Contact