我正在为我的应用程序运行gwt测试,这就像一场噩梦,一个接一个地遇到问题,不知道出了什么问题。
首先,我创建了一个虚拟测试用例:
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);
}
}
当我运行'mvn test'时,这个简单的测试失败了。错误消息是:
initializationError0
java.lang.NoClassDefFoundError: com/google/gwt/dev/cfg/Condition
我google了一下,发现我需要在我的pom中包含gwt-dev,然后我就这样做了,再次运行测试,现在它抛出了错误:
[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?
答案 0 :(得分:6)
在Eclipse中的Run Configurations
下查看,然后查看Arguments
标签。
如果移动了类,Eclipse将不会更新命令行参数。
答案 1 :(得分:0)
如果您从启动文件运行测试,则可能需要将模块包含在启动类路径中,例如:
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="Sample" type="1"/> "/>
</listAttribute>