Hi,

Did you try to put the setBaseUrl in the setUp method ? Like this :

import net.sourceforge.jwebunit.WebTestCase;

public class ExampleWebTestCase extends WebTestCase {

    public ExampleWebTestCase(String name) throws Exception {
        super(name);
    }

    public void setUp() {
      super.setUp();
      getTestContext().setBaseUrl("http://www.google.ca/");
    }

    public void testMainPageLinks() {
          beginAt("/");
          assertLinkPresent("Images");
          clickLink("Images");
          assertTitleEquals("Google Image Search");
    }

}

----- Message d'origine ----
De : Gustavo Pichetto <[EMAIL PROTECTED]>
À : [email protected]
Envoyé le : Mercredi, 1 Novembre 2006, 16h45mn 06s
Objet : [Jwebunit-users] Exception in constructor

Hello,
I have just started to use jwebUnit, following the sample in the "getting
started" documentation in the jwebUnit.  Debbugin in  
getTestContext().setBaseUrl("http://www.google.ca/";) I got this exception:


junit.framework.AssertionFailedError: Exception in constructor:
testMainPageLinks (java.lang.NullPointerException
    at net.sourceforge.jwebunit.WebTestCase.getTestContext(WebTestCase.java:84)
    at Ingreso.ExampleWebTestCase.<init>(ExampleWebTestCase.java:10)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at junit.framework.TestSuite.createTest(TestSuite.java:60)
    at junit.framework.TestSuite.addTestMethod(TestSuite.java:279)
    at junit.framework.TestSuite.<init>(TestSuite.java:142)
    at
com.intellij.rt.execution.junit.TestRunnerUtil.createClassOrMethodSuite(TestRunnerUtil.java:127)
    at
com.intellij.rt.execution.junit.TestRunnerUtil.getTestSuite(TestRunnerUtil.java:65)
    at
com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:23)
    at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
)

Here the class:

import net.sourceforge.jwebunit.WebTestCase;

public class ExampleWebTestCase extends WebTestCase {

    public ExampleWebTestCase(String name) throws Exception {
        super(name);
        getTestContext().setBaseUrl("http://www.google.ca/";);
    }

    public void testMainPageLinks() {
          beginAt("http://www.google.ca";);
          assertLinkPresent("Images");
          clickLink("Images");
          assertTitleEquals("Google Image Search");
    }

}


Can somebody help me? Thanks!
Gustavo.

_________________________________________________________________
Sabe más sobre la próxima generación del MSN Messenger.
http://imagine-msn.com/minisites/messenger/default.aspx?locale=es-ar


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users



Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to