Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SWTBot/Snippets"

m (using templates for creating links)
Line 1: Line 1:
 
{{SWTBot}}
 
{{SWTBot}}
 
Some snippets for working with SWTBot
 
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­.
 +
 +
<source lang="bash">
 +
# 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
 +
</source>
  
 
=== Switch perspective ===
 
=== Switch perspective ===

Revision as of 09:24, 8 June 2010


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