如何使用ant以无头格式运行Eclipse Junit Plugin UI测试作为核心测试目标?

时间:2011-07-22 07:40:35

标签: junit eclipse-plugin eclipse-pde

我正在尝试运行一个junit插件测试,这是一个与UI相关的插件测试用例。我可以在使用ant从命令行运行测试并将目标作为ui-test调用时运行。 Workbench启动并执行测试套件。但同样的蚂蚁将目标更改为核心测试,测试套件执行失败。给出异常的结果,如“org.eclipse.swt.SWTException:无法执行runnable(java.lang.IllegalStateException:尚未创建Workbench。)” 使用windowtester开发的测试用例。

我做过eclipse-test framework3.6.2设置。

UI依赖测试用例可以使用核心测试而不是使用核心测试应用程序的ui-test作为无头测试运行。?

java -jar plugins \ org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar -application org.eclipse.ant.core.antRunner -data E:\ HeadlessWT \ refactoring_folder -buildfile E:\ HeadlessWT \ workspace \ Test13 .10 \ build.xml -Dos = win32 -Dws = win32 -Darch = x86_64

错误日志是:

!SESSION 2011-07-21 16:45:26.593 -----------------------------------------------
eclipse.buildId=M20110210-1200
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -application org.eclipse.test.coretestapplication formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,E:\HeadlessWT\workspace\Test13.10\..\../connectionProfile.MyTestSuite1310.xml -testPluginName Test13.10 -className connectionProfile.MyTestSuite1310
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data E:\HeadlessWT\workspace\Test13.10\..\../refactoring_folder -application org.eclipse.test.coretestapplication formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,E:\HeadlessWT\workspace\Test13.10\..\../connectionProfile.MyTestSuite1310.xml -testPluginName Test13.10 -className connectionProfile.MyTestSuite1310 -consolelog

!ENTRY com.instantiations.eclipse 1 0 2011-07-21 16:45:30.203
!MESSAGE UI test starting: connectionProfile.CreateConnProfile_testCreateConnProfile

!ENTRY com.instantiations.eclipse 1 0 2011-07-21 16:45:30.281
!MESSAGE 
*************************************************
WindowTester Runtime 201009131510
   OS:   Windows 2003, amd64, 5.2
   Java: Sun Microsystems Inc., 1.6.0_26
   Spec: Java Platform API Specification, Sun Microsystems Inc., 1.6
   VM:   Java Virtual Machine Specification, Sun Microsystems Inc., 1.0
*************************************************


!ENTRY com.instantiations.eclipse 1 0 2011-07-21 16:45:30.437
!MESSAGE Exception caught in SWTExecutionMonitor.waitUntilFinished():

!ENTRY com.instantiations.eclipse 4 0 2011-07-21 16:45:30.437
!MESSAGE Unexpected exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: Workbench has not been created yet.)
    at org.eclipse.swt.SWT.error(SWT.java:4083)
    at org.eclipse.swt.SWT.error(SWT.java:3998)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
    at com.windowtester.runtime.swt.internal.junit.SWTExecutionMonitor.doWaitForFinish(SWTExecutionMonitor.java:151)
    at com.windowtester.internal.runtime.junit.core.AbstractExecutionMonitor.waitUntilFinished(AbstractExecutionMonitor.java:205)
    at com.windowtester.internal.runtime.junit.core.SequenceRunner.waitUntilFinished(SequenceRunner.java:69)
    at com.windowtester.internal.runtime.junit.core.SequenceRunner.exec(SequenceRunner.java:53)
    at com.windowtester.runtime.common.UITestCaseCommon.runUITest(UITestCaseCommon.java:147)
    at com.windowtester.runtime.common.UITestCaseCommon.runBare(UITestCaseCommon.java:128)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:376)
    at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:209)
    at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:35)
    at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
    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:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
Caused by: java.lang.IllegalStateException: Workbench has not been created yet.
    at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
    at com.windowtester.runtime.swt.internal.finder.ShellFinder.getRootShell(ShellFinder.java:195)
    at com.windowtester.runtime.swt.internal.finder.ShellFinder$3.run(ShellFinder.java:180)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    ... 37 more

!ENTRY com.instantiations.eclipse 1 0 2011-07-21 16:45:30.781
!MESSAGE UI test starting: crudauto.ValidatingPKCRUD_testValidatingPKCRUD

!ENTRY com.instantiations.eclipse 1 0 2011-07-21 16:45:30.781
!MESSAGE Exception caught in SWTExecutionMonitor.waitUntilFinished():

!ENTRY com.instantiations.eclipse 4 0 2011-07-21 16:45:30.781
!MESSAGE Unexpected exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: Workbench has not been created yet.)
    at org.eclipse.swt.SWT.error(SWT.java:4083)
    at org.eclipse.swt.SWT.error(SWT.java:3998)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
    at 
......
......
    ... 37 more

1 个答案:

答案 0 :(得分:1)

不可能。这就是为什么Eclipse有两个不同的ui和核心测试目标。