eclipseeclipse-pluginswtbot

Wait for any background progress going on in eclipse while testing using SWT Bot


I wanted to wait for any operation that are happening in eclipse and then proceed with the test-case, so I need to see if any operation are happening in the background, this is shown in Progress view, but I am unable to get any information using swtbot. How to wait for any background progress going on in eclipse while testing using SWT-Bot?
The Progres view prints No operations to display at this time. when all operation are over, but I dont know how to read for this.


Solution

  • Finally, this is how i did it:

    ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
                @Override
                public void run(IProgressMonitor monitor) throws CoreException {
                    //Do nothing
                }
            }, new NullProgressMonitor());
        }
    

    This submits job to ResourcePlugin and hence it waits till all resource change related process complete.

    To handle the launch/debug process, I get all the launches active and if current project launch is active, I wait for its termination (This has a problem in linux, the isTerminated() function for a launch always return true, even after it is terminated, so I added a timeout while waiting). To get all launches:

    org.eclipse.debug.core.ILaunch launch = DebugPlugin.getDefault().getLaunchManager().getLaunches();
    

    To check if it terminated:

    launch.isTerminated();
    

    Source: Eclipse GUI testing is viable