Home » Eclipse Projects » SWTBot » button.click() => IndexOutOfBoundsException
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Re: button.click() => IndexOutOfBoundsException [message #497918 is a reply to message #497899] |
Fri, 13 November 2009 09: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()");
}
}
|
|
|
Re: button.click() => IndexOutOfBoundsException [message #497926 is a reply to message #497068] |
Thu, 12 November 2009 22:36  |
Eclipse User |
|
|
|
Could you provide more information like a snippet of code that clicks on
the button, a slightly more detailed description of the dialog ?
-- Ketan
Andre Kullmann wrote:
> 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 #497930 is a reply to message #497068] |
Thu, 12 November 2009 22:36  |
Eclipse User |
|
|
|
Could you provide more information like a snippet of code that clicks on
the button, a slightly more detailed description of the dialog ?
-- Ketan
Andre Kullmann wrote:
> 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 #497939 is a reply to message #497068] |
Thu, 12 November 2009 22:36  |
Eclipse User |
|
|
|
Could you provide more information like a snippet of code that clicks on
the button, a slightly more detailed description of the dialog ?
-- Ketan
Andre Kullmann wrote:
> 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é
|
|
|
Goto Forum:
Current Time: Mon Mar 17 15:10:07 EDT 2025
Powered by FUDForum. Page generated in 0.16120 seconds
|