我正在使用eclipse juno和gwt2.5,当我创建由GWTTestCase扩展的测试类时,我遵循gwt Junit test tutorial,我得到了这样的消息:
Description Resource Path Location Type The project was not built since its build path is incomplete. Cannot find the class file for junit.framework.TestCase. Fix the build path then try building this project homeopathischeAnwendung Unknown Java Problem
该怎么办呢?
发布于 2013-01-20 17:02:10
类路径中缺少Junit:http://junit.sourceforge.net/
或者maven依赖:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>发布于 2013-01-22 06:28:01
我找到了解决方案。一开始我犯了一个错误。
我下载了junit.jar并将其添加到构建路径中。那是假的。使用eclipse添加JUnit的正确方法是在包资源管理器中的gwt.project -> Build Path -> add -> junit上单击鼠标右键。
我犯的第二个错误是我的Test-Class的位置。我创建了一个名为"Test“的额外文件夹,并将包和Test-Class放在这个文件夹中。这也是错误的。
MyGwtApplication
src
package.number.one
MyGwtApplication.gwt.xml
package.number.one.client
MyGwtApplication.java
test
package.number.one.testing
MyTestClass.java这是假的!
test-class必须在src文件夹中
MyGwtApplication
src
package.number.one
MyGwtApplication.gwt.xml
package.number.one.client
MyGwtApplication.java
package.number.one.client.testing
MyTestClass.javahttps://stackoverflow.com/questions/14422999
复制相似问题