|
From: Marc G. <mgu...@ya...> - 2005-01-13 10:28:21
|
Have you tryed adding to the classpath all the jars provided in htmlunit distribution?
Marc.
wenrong.chen wrote:
> Hello,
>
> I got a problem when I'm using htmlunit for testing,while the test case is very
> simple listed bellow.
>
> import com.gargoylesoftware.htmlunit.WebClient;
> import com.gargoylesoftware.htmlunit.html.HtmlPage;
> public class SimpleTest extends junit.framework.TestCase {
>
> public void testSimple() throws Exception {
> WebClient webClient = new WebClient();
> java.net.URL url =
> new java.net.URL("http://htmlunit.sourceforge.net");
> HtmlPage page = (HtmlPage)webClient.getPage(url);
> }
> }
>
> Suppose I toggle command for sentence
> "HtmlPage page = (HtmlPage)webClient.getPage(url);", then it works well.
>
> otherwise, it will raise an error when I choose to test it in eclipse
> clicking RUN->Junit Test.
>
> "NoClassDefFoundError" is generated, I wonder whether I missed some packages
> besides junit.jar and htmlunit.jar
>
> I've searched both in the mailing lists and google, but there is no suggestion.
> As a rookie to use this tool, I need your help.
>
> Thanks !
>
>
>
>
> Failure infomation listed bellow:
>
> java.lang.NoClassDefFoundError: org/apache/commons/httpclient/URIException
> at com.gargoylesoftware.htmlunit.WebClient.getWebConnection
> (WebClient.java:251)
> at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse
> (WebClient.java:1401)
> at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:549)
> at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:477)
> at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:349)
> at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:293)
> at FormTest.testForm(FormTest.java:26)
> 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:421)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
> (RemoteTestRunner.java:305)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
> (RemoteTestRunner.java:186)
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Htmlunit-user mailing list
> Htm...@li...
> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>
|