Typically an action may require some result to happen in the user interface before testing can continue. Since the SWTBot can run much faster than a human can, waiting for the result of an action may be necessary. To demonstrate this, create a Java project with a single source file and then use the conditions to wait until the class file is compiled.
Create a new method in the
UITest
class calledcreateJavaProject
.Use the
bot
to create a new Java project by copying thecreateProject
method as a template.Add the
org.eclipse.core.resources
as a dependency to the plug-in.Add a method
getProject
, which takes aprojectName
and returns anIProject
fromResourcesPlugin.getWorkspace().getRoot().getProject()
.At the end of the
createJavaProject
method, use thegetProject
method with the test project to get the foldersrc
.If the folder does not exist,
create
it.Get the file from
src
calledTest.java
.Create it with the contents from
class Test{}
bytes as aByteArrayInputStream...