independent test problem [message #682171] |
Fri, 10 June 2011 14:49 |
fan Missing name Messages: 7 Registered: June 2011 |
Junior Member |
|
|
Hello I wrote a test for checking a Wizard and his Back-button of a normal Eclipse Wizard.
This Test runs fine if I use it somewhere in the workflow. But when it is started first, the follwing tests, who all start with
Bot.menu("File").menu("New").menu("Project").click();
,fail. I always get a WidgetNotFoundException on the .menu("File") .
The aktive Shell after the test is the Eclipse shell, so that should not be the problem.
I wrote some classes to interact with buttons, comboboxes and other widgets, but I think the following metho is still understandable without knowing this classes:
public static void backAndNextButtonTest (SWTWorkbenchBot bot ){
bot.menu("File").menu("New").menu("Project").click();
findTCPWShell(bot);
String testName = "Project1";
String testLocation ="c:\\test";
Button next = Button.getButtonByTitle(wizBot,NEXT_BUT_TEXT);
Button finish = Button.getButtonByTitle(wizBot,FINISH_BUT_TEXT);
Button back = Button.getButtonByTitle(wizBot,BACK_BUT_TEXT);
Button cancel = Button.getButtonByTitle(wizBot,CANCEL_BUTTON_TEXT);
Textfield textProName = Textfield.getTextByLabel(wizBot,PROJECT_NAME_TEXTFIELD_LABEL );
Textfield textLoc = Textfield.getTextByLabel(wizBot,LOCATION_TEXTFIELD_LABEL );
CheckBox useDefaultCheckBox = CheckBox.getCheckBoxByLabel(wizBot, DEFAULT_LOCATION_CHECKBOX_LABEL);
textProName.setText(testName);
useDefaultCheckBox.UnCheck();
textLoc.setText(testLocation);
next.clickButton();
SWTBotShell confirmShell=null;
try{
confirmShell = wizBot.shell(CONFIRM_SHELL_LABEL);
}catch (WidgetNotFoundException e)
{
//do nothing , location already created
}
if ( null != confirmShell )
{
Button.getButtonByTitle(wizBot, CONFIRM_SHELL_OK_BUT_TEXT).clickButton();
wizBot.waitUntil(Conditions.shellCloses(confirmShell));
}
//NEXT PAGE : doing settings -> using BACK Button //
CheckBox ldfModelCheckBox = CheckBox.getCheckBoxByLabel(wizBot, LDF_MODEL_CHECKBOX_LABEL);
assertTrue (ldfModelCheckBox.isChecked());
SWTBotCombo langBox = TCPWShell.bot().comboBox(LANGUAGE_COMBO_SHOWN_OPTION);
langBox.setSelection("xxx");
SWTBotCombo typBox = TCPWShell.bot().comboBox(TYP_COMBO_SHOWN_OTPION);
typBox.setSelection("xxx");
SWTBotCombo hardWBox = TCPWShell.bot().comboBox( HARDWARE_COMBO_SHOWN_OPTION);
hardWBox.setSelection("xxx");
ldfModelCheckBox.UnCheck();
back.clickButton();
//PREVIOUS PAGE : checking settings -> using NEXT Button//
assertTrue ( textLoc.getText().trim().equals(testLocation));
assertTrue ( textProName.getText().trim().equals(testName));
assertTrue ( useDefaultCheckBox.isUnChecked());
assertTrue(back.isDisabled() && next.isEnabled() && finish.isDisabled() && cancel.isEnabled());
next.clickButton();
// NEXT PAGE : checking settings //
assertTrue(back.isEnabled() && next.isDisabled() && finish.isEnabled() && cancel.isEnabled());
assertTrue (langBox.getText().equals("xxx"));
assertTrue (typBox.getText().equals("xxx"));
assertTrue (hardWBox.getText().equals("xxx"));
cancel.clickButton();
wizBot.waitUntil(Conditions.shellCloses(TCPWShell)) ;
removeLocation(testLocation);
}
private static void findTCPWShell (SWTWorkbenchBot bot ) {
wizBot = bot;
wizBot.waitUntil(Conditions.waitForShell(TCPWmatcher));
TCPWShell = new SWTBotShell ((Shell) wizBot.widget(TCPWmatcher));
assertTrue(TCPWShell.isActive());
}
I also get the following Failure messages, but i am not sure if they have anything to do with this Problem :
org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.core.runtime.AssertionFailedException: null argument:)
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument:
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
at org.eclipse.jface.viewers.StructuredSelection.<init>(StructuredSelection.java:74)
at com.rt.hightec.framework.buildsystem.action.ChangeBuildConfigBuildAction.fillMenu(Unknown Source)
at org.eclipse.cdt.ui.actions.ChangeBuildConfigMenuAction$1.menuShown(ChangeBuildConfigMenuAction.java:98)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:241)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.findMenusInternal(MenuFinder.java:152)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.findMenusInternal(MenuFinder.java:161)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.findMenusInternal(MenuFinder.java:161)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.access$0(MenuFinder.java:149)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder$2.run(MenuFinder.java:124)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder$2.run(MenuFinder.java:1)
at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$2.doRun(UIThreadRunnable.java:140)
at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$1.run(UIThreadRunnable.java:89)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
... 24 more
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03175 seconds