Hi,
 
Am in the process of test automation of an application. Came across Jwebunit.
When I tried using Jwebunit, am facing an issue. It is not able to get itself 
connected to my application.
Am getting a ConnectException. Can you help me out.
 
Thanks in Advance.
Anmol
   
PFB the code.
 
 
************************************************************************
package examples;
import net.sourceforge.jwebunit.junit.WebTestCase;
public class SampleJunit  extends WebTestCase {
 
public SampleJunit(String name) throws Exception{
 super(name); 
}
public void setup() throws Exception{
 super.setUp();
 getTestContext().setBaseUrl("http://localhost:7001/MyWeb";);
}
public void testFormSubmission() { 
    beginAt("/index.jsp");   
    assertFormPresent("inputform");
    assertFormElementPresent("txtFileName");
    setTextField("txtFileName", "Sai");
    submit();   
}
}
****************************************************************************
 
 
PFB the stack trace :
 
***************************************************************************
java.lang.RuntimeException: java.net.ConnectException: Connection refused: 
connect
 at 
net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.beginAt(HtmlUnitDialog.java:172)
 at net.sourceforge.jwebunit.junit.WebTester.beginAt(WebTester.java:188)
 at net.sourceforge.jwebunit.junit.WebTestCase.beginAt(WebTestCase.java:121)
 at examples.SampleJunit.testFormSubmission(SampleJunit.java:16)
 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:164)
 at junit.framework.TestCase.runBare(TestCase.java:130)
 at net.sourceforge.jwebunit.junit.WebTestCase.runBare(WebTestCase.java:50)
 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:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:230)
 at junit.framework.TestSuite.run(TestSuite.java:225)
 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)
Caused by: java.net.ConnectException: Connection refused: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
 at java.net.Socket.connect(Socket.java:452)
 at java.net.Socket.connect(Socket.java:402)
 at java.net.Socket.<init>(Socket.java:309)
 at java.net.Socket.<init>(Socket.java:184)
 at 
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
 at 
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
 at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
 at 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321)
 at 
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
 at 
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
 at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
 at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
 at 
com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:126)
 at 
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1371)
 at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1329)
 at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
 at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:389)
 at 
net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.beginAt(HtmlUnitDialog.java:164)
 ... 19 more
*****************************************************************************

 
---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to