2014-05-21 7 views
1

SwtBot 2.2.1을 사용하여 간단한 새 프로젝트 마법사를 자동화하려고합니다. 코드는 내가 문제는 click() 메서드 호출이 반환하지 않을 것입니다 튜토리얼클릭시 SWTBot이 작동하지 않음

bot.menu("File").menu("New").menu("Project...").click(); 

에서 발견 한 것입니다. 필자의 타겟 플랫폼은 Linux x86_64의 Eclipse Kepler입니다. 그러나 새 프로젝트 대화 상자가 표시되므로 호출이 반환되지 않는 이유는 확실하지 않습니다. 다음은 테스트중인 이클립스 인스턴스가 테스트를 끊으면 어떻게 생겼는지의 스크린 샷이다

swtbot workspace

메인 스레드의 스택 추적 내가 성공적으로 테스트 실행을 만들기 위해 할 수있는 일

"main" prio=10 tid=0x00007f12c0006000 nid=0x428b runnable [0x00007f12c68d2000] 
    java.lang.Thread.State: RUNNABLE 
    at org.eclipse.swt.internal.gtk.OS.Call(Native Method) 
    at org.eclipse.swt.widgets.Display.sleep(Display.java:4233) 
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:827) 
    at org.eclipse.jface.window.Window.open(Window.java:802) 
    at org.eclipse.ui.actions.NewProjectAction.run(NewProjectAction.java:117) 
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:499) 
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) 
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) 
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) 
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401) 
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187) 
    at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot$2.run(AbstractSWTBot.java:166) 
    at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$5.doRun(UIThreadRunnable.java:221) 
    at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.run(UIThreadRunnable.java:78) 
    at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.asyncExec(UIThreadRunnable.java:223) 
    at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.asyncExec(AbstractSWTBot.java:576) 
    at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.notify(AbstractSWTBot.java:155) 
    at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.notify(AbstractSWTBot.java:136) 
    at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.notify(AbstractSWTBot.java:126) 
    at org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu.click(SWTBotMenu.java:60) 
    at org.apache.sling.ide.test.impl.ui.NewContentPackageWizardTest.createNewContentProject(NewContentPackageWizardTest.java:55) 
    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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) 
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) 
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) 
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) 
    at org.junit.rules.RunRules.evaluate(RunRules.java:20) 
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) 
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309) 
    at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner.run(SWTBotJunit4ClassRunner.java:54) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) 
    at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47) 
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) 
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135) 
    - locked <0x00000000fe4fc480> (a org.eclipse.swt.widgets.RunnableLock) 
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3717) 
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3366) 
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) 
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) 
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140) 
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611) 
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) 
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) 
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) 
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54) 
    at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47) 
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48) 
    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: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: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) 

입니다 ?

답변

2

UI 스레드에서 테스트를 시작하는 중 오류가 발생했습니다. 실행 구성에서 'UI 스레드에서 실행'의 선택을 취소하면 테스트가 정상적으로 실행됩니다.

관련 문제