Typically, an action may require a result to happen in the user interface before testing can continue. Since SWTBot can run much faster than a human can, waiting for a 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 called
createJavaProject()
in theUITest
class.Use the
bot
to create a new Java project by copying thecreateProject()
method as a template.Add
org.eclipse.core.resources
as a dependency to the plug-in.Add a method
getProject()
, which returns anIProject
fromResourcesPlugin.getWorkspace().getRoot().getProject()
.Use the
getProject()
with the test project to get thesrc
folder .If the folder does not exist, create it.
Get the file called
Test.java
fromsrc
.Create it with the contents from the
"class {}".getBytes()
bytes as aByteArrayInputStream
.Use the
bot.waitUntil()
call to pass in a new...