[SWTBot-users] problem with running swt bot in eclipse
Brought to you by:
kpadegaonkar
|
From: Somesh S. <som...@gm...> - 2008-05-30 02:13:15
|
Hi Ketan,
you probably don't remember me but we had lunch on the first day at
EclipseCon 2008.
Anyhow, I am trying to use SWT Bot to test a plugin that we have written.
I am trying to invoke a wizard and type stuff in it and press finish.
It opens up the wizard but hangs in menu.click(); and therefore I can't seem
to continue.
I tried creating a test case to invoke the standard java project wizard
here is the some sample code that i tried but it didn't work
added a file in a fresh plugin project
import org.eclipse.swt.widgets.Widget;
import net.sf.swtbot.SWTBot;
import net.sf.swtbot.SWTBotTestCase;
import net.sf.swtbot.eclipse.finder.SWTEclipseBot;
import net.sf.swtbot.widgets.SWTBotMenu;
import net.sf.swtbot.widgets.SWTBotShell;
import net.sf.swtbot.widgets.TimeoutException;
import net.sf.swtbot.widgets.WidgetNotFoundException;
public class test extends TestCase{
public void testProjectInvoke() throws WidgetNotFoundException{
SWTEclipseBot bot = new SWTEclipseBot();
bot.menu("File").menu("New").menu("Java Project").click();
try {
bot.shell("New Java Project").activate();
bot.textWithLabel("Project name:").setText("MyProject");
bot.button("Finish").click();
} catch (TimeoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
ran this as a Junit-Plugin Test
on running this target, a target Eclipse sdk.ide is launched, the wizard
shows up and hangs.
I tried to debug and it seems that it doesn't come out of line 212 in
AbstractSWTBot.java ( widget.notifyListeners(...) );
Any help is appreciated.
Also, I struggled to find some examples with testing Eclipse Plugins. It'd
be nice to have some test samples around on the wiki. I do not want to go
the record and play way but want to write tests just like i would write a
junit test.
Thanks in advance.
Somesh
|