Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Using SWTBot as script while developing RCP app

DZone's Guide to

Using SWTBot as script while developing RCP app

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

SWTBot is a great tool for writing UI tests. However, you can also use it as script to automate your clicks while developing UI.

Use Case

Suppose we are developing a wizard and we are designing the UI on third page. Now each time we will have to launch our application and then invoke the wizard. Provide template info for first two pages to reach the page where we are actually working currently. While designing UI we do these steps a number of times

You can use SWTBot to automate these clicks. The idea is simple. Write an SWTBot script for the clicks to be automated, invoke it using Startup extension.

How to do it?

1. Add SWTBot to Target Platform

i) Edit the target platform and add a new 'Software Site' location.

ii) Provide the URL http://download.eclipse.org/technology/swtbot/helios/dev-build/update-site  (see http://www.eclipse.org/swtbot/downloads.php for relevant url for your Eclipse version).

iii) Select 'SWTBot Eclipse features'.

2) Add the SWTBot script using Startup extension

i) Create a dummy plug-in

ii) Add the 'org.eclipse.ui.startup' extension and create the class that will get invoked by it

iii) Add your SWTBot script to this class created above.

iv) You will have to add the dependency to 'org.eclipse.swtbot.eclipse.finder' for the SWTBot to compile.

v) Include this plug-in and the SWTBot plug-ins from the target to your launch configuration.

How this works?

The 'startup' extension makes the SWTBot script run when your application is launched. Adding the SWTBot to launch configuration will ensure it will be able to run when launched.

 From http://blog.ankursharma.org/2011/06/using-swtbot-as-script-while-developing.html

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}