I'm starting to wonder if this might be netbeans related. I let
netbeans build my test class stubs but I'm not sure if netbeans's
follows the right pattern. The developer's guide says:

"Run your test case. Use the class junit.textui.TestRunner as your
main class and pass the full name of your test class as the command
line argument, e.g. com.example.foo.client.FooTest. When running the
test case, make sure your classpath includes:" etc etc

I've been just telling netbeans to Test the project by clicking on the
project and selecting test. Will this not work? I'm not really sure
where to test the junit testing parameters and commandline arguments.

I tried creating an empty junit test case (by which I mean the methods
were all empty) and it threw no errors. I tried removing lines in the
real methods to see which line  made it explode but it seemed like
anything at all in the test methods caused the issues, even if the
only line was finishTest(). I'm not really sure how to interpret this
behavior.

This is the test class. Some of the annotations have been commented
out because I've been testing for junit 3 and junit 4 to see if I
could get either to work. The methods basically just make an RPC call
and then say it worked successfully. You can find the asynchronous
callback functions defined at the bottom of the code.
Any suggestions or thoughts would be most welcome




package com.baa.client;

import com.baa.client.model.WebAppRestDataSource;
import com.baa.client.presentation.DynamicFormPresentation;
import com.google.gwt.junit.client.GWTTestCase;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import java.io.File;
import java.util.Arrays;

public class BaseDynamicFormTest extends GWTTestCase{

    public BaseDynamicFormTest()
    {
        //
ClasspathUtility.printMembers("org.apache.commons.httpclient.HttpClient");
    }

    @Override
    public String getModuleName() {
        return "com.baa.Scaffolding";
    }



    //@Test
    public void testFetchData()
    {
        finishTest();
    }

    //@Test
    public void testGetXSD()
    {
        BaseDynamicFormImpl impl = new BaseDynamicFormImpl();
        TestDynamicFormXSDDSCallBack xsdCallBack = new
TestDynamicFormXSDDSCallBack();
        TestDynamicFormDataDSCallBack dataCallBack = new
TestDynamicFormDataDSCallBack();
        dataCallBack.setForm(impl);
        xsdCallBack.setForm(impl);

        xsdCallBack.setDsCallback(dataCallBack);
        this.delayTestFinish(5000);
        impl.fetchXSD(null, xsdCallBack);
    }

    public class BaseDynamicFormImpl extends BaseDynamicForm {

        public DynamicFormPresentation getPermissionsObject() {
            return null;
        }
    }

    public class TestDynamicFormXSDDSCallBack extends
DynamicFormXSDCallBack
    {
        protected BaseDynamicFormTest test;
        @Override
        public void execute(WebAppRestDataSource ds) {
            super.execute(ds);
            //validate correctness
            test.finishTest();
        }
    }

    public class TestDynamicFormDataDSCallBack extends
DynamicFormDataCallBack
    {
        protected BaseDynamicFormTest test;
        @Override
        public void execute(DSResponse response, Object rawData,
DSRequest request)
        {
            super.execute(response, rawData, request);
            //validate correctness
            test.finishTest();
        }
    }
}


On Nov 12, 7:26 am, darkling <[email protected]> wrote:
> Yes it extends GWTTestCase. I'm assuming this needs to be some kind of
> classpath/classloader bug but I'm not really sure where to look. Is
> this code executed in the server? Should I be checking my server libs?
> Any suggestions or advice would be welcome
> Thanks
>
> On Nov 11, 11:22 pm, Didier Durand <[email protected]> wrote:
>
> > Hi,
>
> > Does your test case extends GWTTestCase: 
> > seehttp://code.google.com/webtoolkit/doc/latest/DevGuideTesting.html#Dev...
> > for all details
>
> > regards
> > didier
>
> > On Nov 11, 5:59 pm, darkling <[email protected]> wrote:
>
> > > I'm trying to build some unit tests for a GWT application.
>
> > > I'm using GWT 2.2, SmartGWT 1.6,JUNIT4.5 (I also triedJUNIT3.8),
> > > Tomcat 6, and Netbeans 6.9.1.
>
> > > What happens is that I'll try to run my tests and the test will crash
> > > hard with the following exception:
>
> > > Exception in thread "htmlUnit client thread"
> > > java.lang.NoSuchMethodError:
> > > org.apache.commons.httpclient.HttpClient.<init>(Lorg/apache/commons/
> > > httpclient/HttpConnectionManager;)V
> > >         at
> > > com.gargoylesoftware.htmlunit.HttpWebConnection.createHttpClient(HttpWebConnection.java:
> > > 394)
> > >         at
> > > com.gargoylesoftware.htmlunit.HttpWebConnection.getHttpClient(HttpWebConnection.java:
> > > 352)
> > >         at
> > > com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:
> > > 94)
> > >         at
> > > com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:
> > > 1397)
> > >         at
> > > com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:
> > > 1331)
> > >         at
> > > com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:293)
> > >         at
> > > com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:354)
> > >         at
> > > com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:339)
> > >         at com.google.gwt.junit.RunStyleHtmlUnit
> > > $HtmlUnitThread.run(RunStyleHtmlUnit.java:100)
>
> > > I realize that NoSuchMethodError is almost invariably caused by
> > > classpath or classloader issues and have been trying to dissect that
> > > but without success. I can only find one copy of htmlunit on my
> > > runtime classpath (it's in GWT-user.jar) and I'm not really sure where
> > > else to look for causes of this problem.
> > > Do I need to add GWT jars to Tomcat or something for my unit tests to
> > > work?
> > > Has anyone run into this problem before? I can't figure out how I can
> > > solve it. Any suggestions or strategies would be most appreciated.
> > > Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to