Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

SWTBot/Snippets


SWTBot
Website
Update Sites
Community
Mailing List
Forums/Newsgroups
IRC
Contribute
Open Bugzilla tickets
Open Gerrit reviews
Browse Source
Continuous Integration


Some snippets for working with SWTBot

Installing/Updating on the command line

Here is a little bash script to help manage SWTBot's version on the command line. Useful for managing an Eclipse installation used for Continuous Integration. It is by no means perfect and you will need to set the proper version for the equinox launcher and the swtbot repository (ganymede, galileo or helios). Feel free to modify to fit your needs­.

# Uninstall the feature.
java -jar plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar \
 -application org.eclipse.equinox.p2.director \
 -uninstallIU org.eclipse.swtbot.eclipse.gef.feature.group,org.eclipse.swtbot.eclipse.test.junit4.feature.group \
 -consoleLog -nosplash
# (Re)Install the feature. This is how you update in the p2 world.
java -jar plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar \
 -application org.eclipse.equinox.p2.director \
 -repository http://download.eclipse.org/technology/swtbot/galileo/dev-build/update-site/ \
 -installIU org.eclipse.swtbot.eclipse.gef.feature.group,org.eclipse.swtbot.eclipse.test.junit4.feature.group \
 -consoleLog -nosplash

Switch perspective

This allows you to switch perspectives in eclipse from within the Window>Open Perspective>Other... menu.

// Change the perspective via the Open Perspective dialog       
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
openPerspectiveShell.activate();
 
// select the dialog
bot.table().select("Debug");
bot.button("OK").click();

Back to the top