|Re: Timeout Issues in SWTBot Tests [message #1741087 is a reply to message #1740978]
||Mon, 22 August 2016 21:21
| Patrick Tasse
Registered: July 2009
I think you are on the right track to avoid sleeps and instead wait until conditions. In our project (Trace Compass) we have many SWTBot tests and have investigated such timing issues often.
The first thing to know, is if it is a matter of the test machine being slow. I understand you are running the test on your own workstation ("hands off the keyboard"). Your test fails because it doesn't find a Tree. Do you see the Tree when it fails? Does it appear later? Then it would just be fixed by increasing the timeout delay, and there is nothing wrong with SWTBot or your test.
If you see the Tree but the test fails, then maybe the bot that you are using is not searching in the right shell or the right view. Make sure you narrow down the scope as much as possible before trying to find a SWTBot widget. Otherwise it might just use the active shell or view and which one is currently active would be random based on timing.
Otherwise, most likely you are not seeing the Tree when it fails. Then the problem is not really in the condition or the delay, but it is in the previous actions that trigger this widget to appear.
I have seen things like:
- pressing a keyboard shortcut and its effect is not immediate, but the next action requires its effect to have occurred
- changing a selection and a menu or command that depends on this selection is not yet enabled
- an action is done on a widget that does not have focus
Some of these might be fixed by making SWTBot more robust, if we can pinpoint the root issue. It would help if you could, by logging or debugging your application, figure out if the actions that should make your tree appear are indeed executed correctly, and if not, why.
Powered by FUDForum
. Page generated in 0.01904 seconds