11

I'm running gwt test for my application, it's like a nightmare, got problem one after another, not sure what's going wrong.

First, I created a dummy test case:

public class ListItemTest extends GWTTestCase {

  /**
   * Specifies a module to use when running this test case. The returned
   * module must include the source for this class.
   * 
   * @see com.google.gwt.junit.client.GWTTestCase#getModuleName()
   */
    @Override
    public String getModuleName() {
        return "com.dyihi.services.sample.Sample";
    }

    /**
     * Add as many tests as you like
     */
    public void testSimple() {
        assertTrue(true);
    }
}

When I ran 'mvn test' this simple test failed. The error message is:

initializationError0
java.lang.NoClassDefFoundError: com/google/gwt/dev/cfg/Condition

I googled around and found out that I need to include gwt-dev in my pom, and I did that, ran the test again, now it threw error:

[ERROR] Unable to find 'Sample.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

3 Answers 3

6

I found Eclipse's Run Configuration Classpath tab worked for me.

You might already have an entry like java - appnameis/src/main/

It seems a pointless hack but the following worked for me

Press the Green "Play" button > Run configurations > Classpath tab

Select one of the User Entries e.g. java - appnameis/src/main/

Select the Advanced button

Select Add Folders drill down to appnameis/src/main/java/app/name OK

You now have entries like:

java - appnameis/src/main/

is - appnameis/src/main/java/app/name

Where your appnameis.gwt.xml file is directly under the is folder

Run

6

Check under Run Configurations in Eclipse, and check the Arguments tab. If the class is moved, Eclipse won't update the command line arguments.

0

If you're running the test from a launch file you might need to include your module in the launch classpath, for example:

<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
    <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;Sample&quot; type=&quot;1&quot;/&gt;&#13;&#10;"/>
</listAttribute>

Not the answer you're looking for? Browse other questions tagged or ask your own question.