NetBeans GWT and JUNIT

58 views
Skip to first unread message

darkling

unread,
Dec 3, 2010, 9:24:08 AM12/3/10
to Google Web Toolkit
I'm trying to debug my Junit test case because its throwing tons of
errors. However when I try to debug it instead of being able to run
it, it tells me

The test class 'com.baa.client.BaseDynamicFormTest' was not found in
module 'com.baa.AccountView'; no compilation unit for that type was
seen
com.google.gwt.junit.JUnitFatalLaunchException: The test class
'com.baa.client.BaseDynamicFormTest' was not found in module
'com.baa.AccountView'; no compilation unit for that type was seen
at
com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:
605)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:
1189)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:
1152)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:
541)
at
com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:406)
at
com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:282)


So now rather than debugging the errors that are caused when I run the
test, I'm trying to debug the errors that only appear when I debug the
test!

I've seen lots of posts on this basic topic but they've all been
Eclipse based and I'm not sure how to translate it for Netbeans. I'm
using the GWT netbeans plugin and my test classes live in the test
directory not the src directory.
This is my module file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.0//
EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.0/distro-
source/core/src/gwt-module.dtd">
<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name="com.google.gwt.user.User"/>
<inherits name="com.smartgwt.SmartGwt"/>

<!-- TODO: remove from production -->
<!-- provides access to SmartGWT console for debugging, to start
console enter javascript:isc.showConsole() in browser URL -->
<inherits name="com.smartgwt.tools.SmartGwtTools"/>

<!-- SmartGWT skin that we modify -->
<!-- TODO: determine if we can rename this -->
<inherits name="com.smartclient.theme.silverwave.SilverWave"/>
<!--<inherits name="com.smartgwt.SmartGwtNoTheme"/>-->

<!-- TODO: remove from production -->
<!-- For development, only compile one permutation to save time -->
<!-- Possible user.agent settings: ie6,ie8, gecko, gecko1_8(FireFox
2), safari, opera -->
<!--<set-property name="user.agent" value="ie8"/>-->
<set-property name="user.agent" value="gecko1_8"/>
<inherits name="com.google.gwt.junit.JUnit"/>
<!-- Include client-side source we might like to test -->
<source path="client"/>
<!-- Include client-side source for the test cases -->
<source path="test"/>
<!-- Specify the app entry point class. -->
<entry-point class="com.baa.client.WebAppEntryPoint"/>
</module>


I'm trying to include the test sources in the module but I'm not sure
if I did it right. Can anyone help me?
Thanks

darkling

unread,
Dec 3, 2010, 2:33:15 PM12/3/10
to Google Web Toolkit
I also wanted to add my Test class in case something in there is being
done wrong:





package com.baa.client;

import com.baa.client.model.WebAppRestDataSource;
import com.baa.client.presentation.DummyDynamicFormPresentation;
import com.baa.client.presentation.DynamicFormPresentation;
import com.google.gwt.junit.client.GWTTestCase;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;

/**
*
* @author mmagliocca
*/
public class BaseDynamicFormTest extends GWTTestCase{

public BaseDynamicFormTest()
{
//ClasspathUtility.printDuplicates();
}

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



/*
@Test
public void testTest() {
}

@Test
public void testSave() {
}

@Test
public void testCancel() {
}

@Test
public void testGetPermissionsObject() {
}
*/
//@Test
public void testFetchData()
{
int x =1;
x++; //finishTest();
}

//@Test
public void testGetXSD()
{
BaseDynamicFormImpl impl = new BaseDynamicFormImpl();
TestDynamicFormXSDDSCallBack xsdCallBack = new
TestDynamicFormXSDDSCallBack();
TestDynamicFormDataDSCallBack dataCallBack = new
TestDynamicFormDataDSCallBack();
Criteria criteria = new Criteria("ID", "3");
dataCallBack.setForm(impl);
xsdCallBack.setForm(impl);
xsdCallBack.setForm(impl);
xsdCallBack.setDsCallback(dataCallBack);
xsdCallBack.setForm(impl);
this.delayTestFinish(5000);
impl.fetchXSD(criteria, xsdCallBack);
}

/*
@Test
public void testSetValidator() {
}
*/
public class BaseDynamicFormImpl extends BaseDynamicForm {

public DynamicFormPresentation getPermissionsObject() {
return new DummyDynamicFormPresentation(null);
}
}

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

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

darkling

unread,
Dec 6, 2010, 8:14:37 AM12/6/10
to Google Web Toolkit
I've been working on this all weekend without success. Can anyone help
me?
Reply all
Reply to author
Forward
0 new messages