Home » Eclipse Projects » SWTBot » button.click() => IndexOutOfBoundsException
button.click() => IndexOutOfBoundsException [message #497068] |
Thu, 12 November 2009 12:38  |
Eclipse User |
|
|
|
Hi,
I try to write an simple testcase. An 'yes no' dialog is shown, after the yes button was clicked an IndexOutOfBoundsException is thown 
Does anyone known whats going wrong ?
Here's the complet stacktrace.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:546)
at java.util.ArrayList.get(ArrayList.java:321)
at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncE xec(UIThreadRunnable.java:173)
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.syncExe c(AbstractSWTBot.java:475)
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.notify( AbstractSWTBot.java:139)
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.notify( AbstractSWTBot.java:127)
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.notify( AbstractSWTBot.java:117)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotButton.click(SWT BotButton.java:73)
at com.company.my.TwoTest.doSomething(TwoTest.java:67)
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:350)
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:208)
at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests(UITestApplication.java:115)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:595)
Thanks,
André
|
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Re: button.click() => IndexOutOfBoundsException [message #497918 is a reply to message #497899] |
Fri, 13 November 2009 14:48  |
Eclipse User |
|
|
|
Hi Ketan,
here's the simple code
ApplicationWorkbenchAdvisor {
[...]
@Override
public boolean preShutdown() {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
String dialogBoxTitle = "Hello";
String question = "World";
return MessageDialog.openQuestion(shell, dialogBoxTitle, question);
}
}
ApplicationActionBarAdvisor {
[...]
protected void makeActions(IWorkbenchWindow window) {
exitAction = ActionFactory.QUIT.create(window);
register(exitAction);
}
protected void fillMenuBar(IMenuManager menuBar) {
MenuManager fileMenu = new MenuManager("Datei",IWorkbenchActionConstants.M_FILE);
menuBar.add( fileMenu );
fileMenu.add(exitAction);
}
}
And the Testcase
SwtbotTest {
private final SWTWorkbenchBot bot = new SWTWorkbenchBot();
@Test
public void doSomethine() throws Exception {
System.out.println("+++ SwtbotTest.doSomethine()");
Thread.sleep(1000);
bot.menu("Datei").menu("Beenden").click();
Thread.sleep(1000);
// Hack to find the right button
try {
for( int i=0; ;i++ ) {
if( "&Ja".equals( bot.button(i).getText() ) )
bot.button(i).click();
}
} catch( ArrayIndexOutOfBoundsException e ) { }
System.out.println("--- SwtbotTest.doSomethine()");
}
}
|
|
| | | |
Goto Forum:
Current Time: Fri Feb 07 04:26:16 GMT 2025
Powered by FUDForum. Page generated in 0.13021 seconds
|