如何使用 ant 使运行 Eclipse Junit Plugin UI 测试以无头格式作为核心测试目标运行?
我正在尝试运行 junit 插件测试,它是 UI 相关的插件测试用例。当使用 ant 从命令行运行测试并将目标调用为 ui-test 时,我能够运行。工作台启动并执行测试套件。但同样的蚂蚁将目标更改为核心测试,测试套件执行失败。结果给出类似“org.eclipse.swt.SWTException:无法执行可运行(java.lang.IllegalStateException:尚未创建工作台。)”的异常 使用windowtester开发的测试用例。
我已经完成了 eclipse-test Framework3.6.2 设置。
UI 相关的测试用例有可能能够使用 core-test 而不是使用核心测试应用程序的 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
I am trying to run a junit plugin test which is UI dependent plugin test case. I am able to run when running the test from command line using ant and calling the target as ui-test. Workbench getting launched and executing the test suite. But the same ant changing the target as core-test, test suite execution getting fail. results giving the exception like "org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: Workbench has not been created yet.)"
Test case developed using windowtester.
I have did the eclipse-test framework3.6.2 setup.
It is possible that UI dependent test case can able to run as headless testing using core-test instead of ui-test using core test application.?
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
Error log is:
!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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不可能。这就是为什么 Eclipse 对于 ui 和 core 测试有两个不同的目标。
Not possible. That's why Eclipse has two different targets for ui and core tests.