Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » when click a button which will open a shell it will hang (solved, because using pde-junit tests)
when click a button which will open a shell it will hang (solved, because using pde-junit tests) [message #536096] Wed, 26 May 2010 23:08 Go to next message
Hao Liu is currently offline Hao Liu
Messages: 2
Registered: May 2010
Location: China BeiJing
Junior Member
Hello Everybody,

II try the example form User's Guide but it fail,
And when I try some other operations, when a button is opening a new shell , click it will cause hanging (eclipse 3.5)

could you help me to solve it?
many thanks!




The code from User's Guide:
@Test
public void canCreateANewJavaProject() throws Exception {
bot.menu("File").menu("New").menu("Project...").click(); //............................ hang

SWTBotShell shell = bot.shell("New Project");
shell.activate();
bot.tree().select("Java Project");
bot.button("Next >").click();

bot.textWithLabel("Project name:").setText("MyFirstProject");

bot.button("Finish").click();
// FIXME: assert that the project is actually created, for later
}



Logs:
(0 ms) [main] DEBUG: org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es : matched ViewReference with text "", using matcher: with name '"Welcome"'
(391 ms) [main] DEBUG: org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es : matched MenuItem with text "&File", using matcher: with mnemonic 'File'
(625 ms) [main] DEBUG: org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es : matched MenuItem with text "File", using matcher: with mnemonic 'File'
(844 ms) [main] DEBUG: org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es : matched MenuItem with text "&File", using matcher: with mnemonic 'File'
(1391 ms) [main] DEBUG: org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es : matched MenuItem with text "&New Alt+Shift+N", using matcher: with mnemonic 'New'
(1422 ms) [main] DEBUG: org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es : matched MenuItem with text "P&roject...", using matcher: with mnemonic 'Project...'
(1422 ms) [main] DEBUG: org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu#setFocus : Attempting to set focus on with mnemonic 'Project...'

............................ hang

[Updated on: Thu, 27 May 2010 02:30]

Report message to a moderator

Re: when click a button which will open a shell it will hang [message #536098 is a reply to message #536096] Wed, 26 May 2010 23:59 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
You might be running the tests as pde-junit tests and not SWTBot tests.

Are you running the test using "right click>run as>swtbot test" ?

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot

On 5/26/10 8:08 PM, Hao Liu wrote:
> Hello Everybody,
>
> II try the example form User's Guide but it fail,
> And when I try some other operations, when a button is opening a new
> shell , click it will cause hanging
>
> could you help me to solve it?
> many thanks!
>
>
>
>
> The code from User's Guide:
> @Test
> public void canCreateANewJavaProject() throws Exception {
> bot.menu("File").menu("New").menu("Project...").click();
> //............................ hang
>
> SWTBotShell shell = bot.shell("New Project");
> shell.activate();
> bot.tree().select("Java Project");
> bot.button("Next >").click();
>
> bot.textWithLabel("Project name:").setText("MyFirstProject");
>
> bot.button("Finish").click();
> // FIXME: assert that the project is actually created, for later
> }
>
>
>
> Logs:
> (0 ms) [main] DEBUG:
> org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es :
> matched ViewReference with text "", using matcher: with name '"Welcome"'
> (391 ms) [main] DEBUG:
> org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es :
> matched MenuItem with text "&File", using matcher: with mnemonic 'File'
> (625 ms) [main] DEBUG:
> org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es :
> matched MenuItem with text "File", using matcher: with mnemonic 'File'
> (844 ms) [main] DEBUG:
> org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es :
> matched MenuItem with text "&File", using matcher: with mnemonic 'File'
> (1391 ms) [main] DEBUG:
> org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es :
> matched MenuItem with text "&New Alt+Shift+N", using matcher: with
> mnemonic 'New'
> (1422 ms) [main] DEBUG:
> org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher#match es :
> matched MenuItem with text "P&roject...", using matcher: with mnemonic
> 'Project...'
> (1422 ms) [main] DEBUG:
> org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu#setFocus : Attempting
> to set focus on with mnemonic 'Project...'
>
> ............................ hang
>
>
Re: when click a button which will open a shell it will hang [message #536109 is a reply to message #536098] Thu, 27 May 2010 02:24 Go to previous message
Hao Liu is currently offline Hao Liu
Messages: 2
Registered: May 2010
Location: China BeiJing
Junior Member
I'm sorry to that, I'm using "right click>run as>JUnit Plug-in Test", there just has this to use.

I checked the Installation of SWTBot, the feature "SWTBot IDE Support " not be installed. (I remember I selected all the items when I was installing it) .

After I install the "SWTBot IDE Support " and use "right click>run as>swtbot test", it runs OK!

thank you!!!




Ketan Padegaonkar wrote on Thu, 27 May 2010 11:59
You might be running the tests as pde-junit tests and not SWTBot tests.

Are you running the test using "right click>run as>swtbot test" ?

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot



Previous Topic:Would you like to try scripting SWTBot ?
Next Topic:ClassCastException during running swtbot test with ant
Goto Forum:
  


Current Time: Mon Jul 28 14:44:36 EDT 2014

Powered by FUDForum. Page generated in 0.03267 seconds