| WizardDialog waitCursor null when #stopped called [message #1121285] |
Mon, 30 September 2013 09:08  |
 |
Craig Foote Messages: 189 Registered: July 2009 |
Senior Member |
|
|
We've made minor changes to WizardProjectImportPage (Import existing projects into workspace) and I'm getting an error but only when running as an SWTBot Test, i.e. it works manually. I'm not sure if it's the changes I've made or a bug in SWTBot.
WizardProjectImportPage#createProjects creates a new WorkspaceModifyOperation (implements IRunnableWithProgress) and passes it to WizardDialog to run and use it's progress monitor via:
getContainer().run(true, true, op);
...then in WiardDialog.run():
...
ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
lockedUI=false;
}
finally
{
...
stopped(state);
...then when WizardDialog#stopped is called I'm getting a NullPointerException when it does:
I've tried debugging with no success. It seems that SWTBot has messed with the cursor somehow.
Any ideas?
Craig
[Updated on: Mon, 30 September 2013 15:33] Report message to a moderator
|
|
|
|
|
|
| Re: WizardDialog waitCursor null when #stopped called [message #1122314 is a reply to message #1121558] |
Tue, 01 October 2013 08:39   |
 |
Craig Foote Messages: 189 Registered: July 2009 |
Senior Member |
|
|
Sorry, just saw your question about not running in UI thread. I know tycho is set up to useUIHarness=true and runInUIThread=false. As for the the SWTBot run config, I see no mention of what thread it's using but I think the default for SWTBot is non-ui thread right? Also, I have another test that works that does not set the "Import existing project into Workspace" wizard "Copy into workspace" radio (it links). It's able to close the dialog which I think would be a problem if I were in UI thread.
Also, I think I probably misspoke when I said I'm running Indigo. I'm targeting indigo (my target platform has 3.7.2 eclipse jars) but I'm developing in kepler.
Craig
[Updated on: Tue, 01 October 2013 09:23] Report message to a moderator
|
|
|
|
| Re: WizardDialog waitCursor null when #stopped called [message #1122563 is a reply to message #1122375] |
Tue, 01 October 2013 14:04  |
 |
Craig Foote Messages: 189 Registered: July 2009 |
Senior Member |
|
|
Yes, sorry, I'm using SWTBot-2.1.0, not 2.10. I see 2.1.1 is out; I looked at its release notes but didn't see anything related to this.
I do use waitWhile and waitUntil a lot. I've been using SWTBot for awhile now and really like the API. Throwing in a Condition now and again is pretty simple and usually makes sense. In this case I get the Finish button and invoke its click() then I have a condition that waits until the dialog closes before progressing (I get all the shells and cycle through their titles to be sure). The problem is that it never gets to its close{}. Upon performFinish() several RunnableWithProgress classes are run, updating the dialog's ProgressMonitor, writing to disk, and cycling through waitCursors. Then, when all are done, the waitCursor is again disposed and nulled but this dispose() causes the NPE. I don't see how but I think maybe not running in the UI thread is interfering with the waitCursor such that it gets nulled (or not even created) before the last RunnableWithProgress completes. I tried wrapping the finishButton.click() in a UIThreadRunnable but got the same result. Of course running the whole test in UI thread won't work because dialogs can't then be closed.
Interestingly, running the same test without checking the "Copy project into workspace" radio button works fine. It does only half the work and uses fewer RunnableWithProgress classes as when copying though so that may account for it somehow.
Testing the stock wizard is pretty straightforward. I can't imagine tests can be written that vary very much that might reveal a path that completes. So I'm convinced its not testable as is. Not sure who's at fault, eclipse or SWTBot, but probably neither. Maybe in eclipse 4.x it's different. Anyway, I've marked that test @Ignore and will have to move on. Thanks very much for your help, at least I don't think it's anything I'm doing wrong now.
Craig
|
|
|
Powered by
FUDForum. Page generated in 0.11497 seconds