Community
Participate
Working Groups
Some methods that spawn asynchronous runnables or jobs have a "syncExec" flag parameter that is set to true when running from tests. This code could be refactored to either return jobs that are then scheduled / run by the test methods or rely on a global flag. The global flag should also be used to suppress password prompting and error dialogs. Platform has examples of similar static flags, e.g.: ErrorDialog.AUTOMATED_MODE SafeRunnable.setIgnoreErrors()
The global state is usually as harmful as using static calls. It is better to use callbacks or handlers instead of such flags, eg. test could pass password handler that won't be showing password request UI. Those callback can be either passed as parameters or injected as dependencies upon component creation.
Steffen: please add this as a discussion item to an upcoming call. There is no perfect way of doing this. We can ask for some advice about this at EclipseCon, since there are benefits to Platform's approach here.
(In reply to comment #2) > There is no perfect way of doing this. Nothing is perfect, but call backs can be generally useful for the headless tools...
Done. Calling TasksUi.synchronize*() magically blocks now when running from a test.