簡體   English   中英

在類路徑中找不到GWTTestCase

[英]GWTTestCase was not found in the classpath

我使用eclipse juno和gwt 2.5,我在創建由GWTTestCase擴展的Test-class時遵循gwt Junit測試教程 ,得到以下消息:

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

該怎么辦?

您的類路徑中缺少Junit: http : //junit.sourceforge.net/

或Maven依賴項:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <scope>test</scope>
</dependency>

我找到了解決方案。 一開始我犯了一個錯誤。

我下載了junit.jar並將其添加到構建路徑。 那是錯誤的。 右鍵單擊gwt.project->構建路徑->添加庫-> JUnit上的包資源管理器,以添加帶有Eclipse的junit的正確方法。

我犯的第二個錯誤是我的測試班級所在的位置。 我創建了一個名為“ Test”的額外文件夾,並在該文件夾中將包與Test-Class放在一起。 那也是錯誤的。

MyGwtApplication
src
    package.number.one
        MyGwtApplication.gwt.xml
    package.number.one.client
        MyGwtApplication.java
test
    package.number.one.testing
        MyTestClass.java

那是錯誤的!

測試類必須位於src文件夾中

MyGwtApplication
src
    package.number.one
        MyGwtApplication.gwt.xml
    package.number.one.client
        MyGwtApplication.java
    package.number.one.client.testing
        MyTestClass.java

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM