2015-02-24 14 views
3

IM試圖創建一個Junit的爲我的Eclipse應用程序,當我試圖運行測試JUnit的插件的JUnit插件測試:試圖創建JUnit我的Eclipse應用程序

public class QFPROMGridTest { 
    @Test public void test() { 
    System.out.println("Testing HGFYGFYYT"); 
    assertTrue(true); 
    } 
} 

以下錯誤拋出,

BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US 
Framework arguments: -version 3 -port 51827 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames com.qualcomm.qti.fusemaster.junitTest.QFPROMGridTest -application org.eclipse.pde.junit.runtime.nonuithreadtestapplication -product org.eclipse.platform.ide -testpluginname com.qualcomm.qti.fusemaster.junitTest 
Command-line arguments: -os linux -ws gtk -arch x86_64 -consoleLog -version 3 -port 51827 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames com.qualcomm.qti.fusemaster.junitTest.QFPROMGridTest -application org.eclipse.pde.junit.runtime.nonuithreadtestapplication -product org.eclipse.platform.ide -data /prj/iceng/qsip1/workspaces/c_hgarik/fusemaster_workspace_Jan19/../junit-workspace -dev file:/prj/iceng/qsip1/workspaces/c_hgarik/fusemaster_workspace_Jan19/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog -testpluginname com.qualcomm.qti.fusemaster.junitTest 

!ENTRY org.eclipse.osgi 4 0 2015-02-24 01:38:45.002 
!MESSAGE Application error 
!STACK 1 
junit.framework.AssertionFailedError 
    at junit.framework.Assert.fail(Assert.java:55) 
    at junit.framework.Assert.assertTrue(Assert.java:22) 
    at junit.framework.Assert.assertNotNull(Assert.java:256) 
    at junit.framework.Assert.assertNotNull(Assert.java:248) 
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.getApplication(NonUIThreadTestApplication.java:103) 
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:36) 
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:601) 
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) 
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) 
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450) 
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426) 
+1

我們可以看到實際的測試嗎? – 2015-02-24 09:48:22

+0

我想打印一個斷言屬實, 公共類QFPROMGridTest { \t @Test \t公共無效測試(){ \t \t的System.out.println( 「測試HGFYGFYYT」); \t \t assertTrue(true); \t} – 2015-02-24 09:50:54

+1

您究竟如何運行測試?你執行什麼步驟? – 2015-02-24 09:54:40

回答

1

此錯誤表示Eclipse運行時找不到在擴展註冊表中啓動的應用程序。

要找出錯誤,首先檢查控制檯輸出。應該有一條以Framework arguments:開頭的行,其中包含-testApplication org.eclipse.ui.ide.workbench(或者根據您的設置,另一個測試應用程序)。

現在打開調試配置...對話框並首先檢查標籤主要的。有一個選項運行應用程序,如果您在控制檯中找到的應用程序不是您所期望的應用程序,則可以使用該應用程序選擇要運行的應用程序。

如果應用程序是你愛的人,去到插件選項卡,如果選擇以下插件檢查:

  • org.eclipse.jdt.junit.runtime
  • org.eclipse.jdt.junit4.runtime
  • org.eclipse.pde.junit.runtime
  • org.eclipse.ui.ide.application

如果沒有,請選擇這些插件,然後使用添加所需插件按鈕添加所有需要的插件。

接下來,單擊驗證插件按鈕並解決所有仍存在的衝突。

如果驗證顯示「未檢測到任何問題」,請單擊「調試」(或「運行」)以再次啓動您的測試。它現在應該可以工作了(至少,在最初得到上述錯誤並遵循這些步驟之後,它對我來說是...)

注意:如果您選擇在啓動配置中啓動產品而不是應用程序,框架參數可能包含-product而不是-testApplication。在這種情況下,您需要查找產品啓動的應用程序,並確保選擇此應用程序的定義插件及其所有依賴項。

相關問題