cannot find Package Explorer if just import a project but okay after creating a new project [message #682385] |
Fri, 10 June 2011 20:58  |
Eclipse User |
|
|
|
Hi!
I am tring to apply SWTBot as our GUI automation test tool, it's very easy to get started, but i encounter a problem. I just import a project, and want to select right-click menu and do something. i used following code to select right-click menu:
SWTBotView view = bot.viewByTitle("Package Explorer");
List controls = new ChildrenControlFinder(view.getWidget()).findControls(WidgetOfType.widgetOfType(Tree.class));
if (controls.isEmpty())
fail("Tree in Package Explorer View was not found.");
SWTBotTree tree = new SWTBotTree((Tree) controls.get(0));
SWTBotTreeItem item = tree.getTreeItem("AndroidPdfViewer");
if(item == null){
throw new WidgetNotFoundException("Could not find menu: test");
}
item.setFocus();
but Package Explorer cannot be found with error
org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Could not find widget.
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetAppears(SWTBotFactory.java:348)
at org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.view(SWTWorkbenchBot.java:128)
at org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.viewByTitle(SWTWorkbenchBot.java:141)
at MyFirstTestCase.convertKona(MyFirstTestCase.java:240)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner.run(SWTBotJunit4ClassRunner.java:54)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
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.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 5000 ms.: Could not find view matching: with name '"Package Explorer"'
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:398)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:372)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:360)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetAppears(SWTBotFactory.java:346)
... 31 more
But if i add create a new project test, try the test above then it's okay, i have no idea about what's going on. Do i use it in a wrong way? or i need update something?
|
|
|
|
Re: cannot find Package Explorer if just import a project but okay after creating a new project [message #689168 is a reply to message #687815] |
Sun, 26 June 2011 23:28   |
Eclipse User |
|
|
|
Hi,Benjamin~
Thanks for your reply, i tried again and found like you mentioned, if import project only, package explorer didn't activate, but project explorer activated, so after changing SWTBotView view = bot.viewByTitle("Package Explorer") to SWTBotView view = bot.viewByTitle("Project Explorer"), it works well. I found during my test, lots of errors are caused due to wrong title usage. I didn't have eclipse and SWTBot experience before, is there any better way to avoid the title related errors, or any documents reference?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06029 seconds