Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Problem with opening File Menu
Problem with opening File Menu [message #32818] Mon, 20 April 2009 08:07 Go to next message
santhosh ram is currently offline santhosh ramFriend
Messages: 6
Registered: July 2009
Junior Member
Hi,
I wrote a test for my plug-in.

When ever i execute my test then first it should change perspective to
that of "MyPlugin". Later it should create a new project using File menu..

There's no problem with the code to change perspective. But perspective
change takes some time to load the plug-in.

Meanwhile SWTBOT is executing the code for creating new project before
loading plug-in completely and the test is failed throwing following
exception.

I think SWTBot is unable to find the widget menu "File " before the
timeout period, as the plug-in takes much time to load than the timeout.

I tried the code with the "Debug" perspective instead of "MyPlugin"
perspective and works fine without any failure.

Please give me some pointers to resolve this issue.


org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundExcep tion: Could
not find widget.
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:365)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFacto ry.java:274)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFacto ry.java:227)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFacto ry.java:218)
at
testsampledialog.MyPluginTest.testCreateNewProject(MyPluginT est.java:61)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
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
org.junit.internal.runners.OldTestClassRunner.run(OldTestCla ssRunner.java:76)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
at
org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:123)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout
after: 10000 ms.: Could not find a menu within the shell 'Shell with text
{Shell {MyPlugin - Eclipse SDK}}' matching 'with mnemonic 'File''
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:431)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:405)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:393)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:363)
Re: Problem with opening File Menu [message #32962 is a reply to message #32818] Wed, 22 April 2009 08:47 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
The problem seems to be the timeout. You can either:

1. Change the timeout value to something higher (see the
SWTBotPreferences[1] class for more)
2. Write a wait for condition to wait until the perspective switch is
completed (see Conditions[2] on how conditions are written)

I'd recommend and prefer option (2).

[1] -
http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/SWTBotP references.java

[2] -
http://github.com/ketan/swtbot/blob/50608a8f7d4632825b700fe5 ba749e2f0b050fea/org.eclipse.swtbot.swt.finder/src/org/eclip se/swtbot/swt/finder/waits/Conditions.java

-- Ketan


santhosh ram wrote:
> Hi,
> I wrote a test for my plug-in.
>
> When ever i execute my test then first it should change perspective to
> that of "MyPlugin". Later it should create a new project using File menu..
>
> There's no problem with the code to change perspective. But
> perspective change takes some time to load the plug-in.
>
> Meanwhile SWTBOT is executing the code for creating new project before
> loading plug-in completely and the test is failed throwing following
> exception.
>
> I think SWTBot is unable to find the widget menu "File " before the
> timeout period, as the plug-in takes much time to load than the timeout.
>
> I tried the code with the "Debug" perspective instead of "MyPlugin"
> perspective and works fine without any failure.
>
> Please give me some pointers to resolve this issue.
>
>
> org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundExcep tion: Could
> not find widget.
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:365)
>
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFacto ry.java:274)
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFacto ry.java:227)
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFacto ry.java:218)
> at
> testsampledialog.MyPluginTest.testCreateNewProject(MyPluginT est.java:61)
> 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 junit.framework.TestCase.runTest(TestCase.java:168)
> at junit.framework.TestCase.runBare(TestCase.java:134)
> 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
> org.junit.internal.runners.OldTestClassRunner.run(OldTestCla ssRunner.java:76)
>
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>
> at
> org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
>
> at
> org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:123)
>
> at
> org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
>
> at java.lang.Thread.run(Unknown Source)
> Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException:
> Timeout after: 10000 ms.: Could not find a menu within the shell 'Shell
> with text {Shell {MyPlugin - Eclipse SDK}}' matching 'with mnemonic 'File''
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:431)
>
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:405)
>
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:393)
>
> at
> org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:363)
>
>
>
>
>
Re: Problem with opening File Menu [message #33033 is a reply to message #32962] Wed, 22 April 2009 13:44 Go to previous message
santhosh ram is currently offline santhosh ramFriend
Messages: 6
Registered: July 2009
Junior Member
Thanks ketan.
I changed the timeout value to some higher value and the problem has
resolved.
Previous Topic:Swing support
Next Topic:opening project properties hack
Goto Forum:
  


Current Time: Fri Apr 26 06:12:44 GMT 2024

Powered by FUDForum. Page generated in 0.02549 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top