Drag and Drop implementation for SWTBot
Short description: Standard Widget Toolkit is a widget toolkit designed for Java to provide portable efficient and portable access to a range of user interface facilities of the operating system on which it is implemented. SWTBot was developed to test the wide variety of applications based on SWT and Eclipse. SWTBot is an automated Java based UI/functional testing tool which can run on any platform on which SWT can run. SWTBot includes most of the features required to automate UI testing making it a very popular and useful tool for developers. However, Drag n Drop feature, which is commonly used in applications nowadays, and more so on mobile devices, is missing in SWTBot. The project aims to provide an implementation of a fully consistent and cross-platform Drag n Drop function for SWTBot, enabling users to write unit tests for Drag n Drop functionality of their Eclipse and SWT based applications using SWTBot. The popularity of the request for this feature in the SWTBot community can be gauged by the length of the CC list on on Bugzilla . The proposed mentor for this project is Mr Mickael Istria (firstname.lastname@example.org).
Standard Widget Toolkit is a widget toolkit designed for Java to provide portable efficient and portable access to a range of user interface facilities of the operating system on which it is implemented. SWTBot was developed to test the wide variety of applications based on SWT and Eclipse. SWTBot is an automated Java based UI/functional testing tool which can run on any platform on which SWT can run. SWTBot includes most of the features required to automate UI testing making it a very popular and useful tool for developers. However, Drag n Drop feature, which is commonly used in applications nowadays, and more so on mobile devices, is missing in SWTBot. The project aims to provide an implementation of a fully consistent and cross-platform Drag n Drop function for SWTBot, enabling users to write unit tests for Drag n Drop functionality of their Eclipse and SWT based applications using SWTBot. The popularity of the request for this feature in the SWTBot community can be gauged by the length of the CC list on on Bugzilla . The proposed mentor for this project is Mr Mickael Istria (email@example.com). Detailed information on the implementation and advantages of this feature are explained in the following sections.
The user interface elements of SWT are called widgets. UI functions like single click, double click, key press perform different functions depending on the widget they are used on. While SWTBot has all UI functions well integrated for automated testing, general support for Drag and Drop functions (on widgets which use it) is lacking. Drag and support comes as a natural choice of user interface function in several application. For example, a SWT application which allows users to create a shopping cart from amongst a list of items in the store. Even though the application might provide alternate ways to achieve this task, a lot of users would prefer to drag and drop the dependencies from the source list to the target location. Drag and Drop would also be the preferred method to reorder data within a table or a list or a tree. Right now, the only way for the application developer to test this functionality is to do manual testing on all possible combination of widgets on which SWT provides Drag and Drop function. Eclipse supports Drag and Drop based on transfer types defined in subclass “org.eclipse.swt.dnd.Transfer.” Every UI element can define if it provides certain transfer type as a source and it accepts a certain transfer type as a destination. The aim of the project is to provide a general implementation of Drag and Drop across all widgets, however the focus will be on the following widgets:
SWTBot has a feature called SWTBot generator and recorder which monitors UI events as they are performed by some user and generates pieces of code that can be reused later in automated tests to playback user actions. This eliminates the need of looking up the SWTBot API and writing code for various UI actions. This also quickens the test case writing process as user just has to perform the UI actions which he needs to test. Drag and Drop can be integrated into the recorder to monitor Drag and Drop events and produce the appropriate lines of code.
For the developers and users of SWTBot, Drag and Drop feature will provide the following benefits:
- Drag and Drop would enable the application developers to write applications for touch based devices where drag and drop is the major UI operation and able to test them with ease.
- Testing time will reduce drastically once drag and drop testing is automated.
- Developers can test Drag and Drop for their application on a wide variety of scenarios and can re-use tests written by others. These scenarios can include drag and drop across different widgets within the same application, or a SWT application to a non-SWT application and vice versa.
- SWTBot Recorder can start recording drag and drop functions, making it even easier to write test cases.
The SWTBot Drag and Drop project would require Eclipse (Juno or Kepler) on a operating system of choice (Windows, in this case) along with SWTBot source code. Since SWTBot is a Maven project, Maven should be installed on the operating system along with m2e plug in for eclipse for building via IDE. GIT would be required to download the source code. SWTBot would need to be installed in order to run SWTBot tests. SWTBot has a well documented API which would be required to write various unit tests for the desired feature. The SWTBot community is very active and helpful in providing guidance in case of any roadblocks.
I participated in Google Summer of Code 2012 under The Eclipse Foundation and it was such a great experience that I want to participate again. I successfully completed the project under the guidance of my mentor Mr. Henrik Rentz Reichert from the eTrice community. Last year GSoC gave me an insight into the architecture of Eclipse plug –ins and I hope to utilize the knowledge to better effect this summer.
I have already setup SWTBot source code and integrated it with Eclipse. I have been successfully able to run it from the command line as well as Eclipse IDE. I have also written a few SWTBot tests to check out the features of SWTBot such as the generator and become familiar with the API. The bug filed for requesting the Drag and Drop feature on Bugzilla features some information as well as ideas of implementation as well. I have gone through possible implementation, discussed the reasons what has been stopping a proper implementation of this feature and I hope to use this information to deliver a fully working and consistent Drag and Drop API to SWTBot. Before the coding period begins, I hope to familiarize myself with as much of source code as possible so I have to spend minimal time on it when the program starts and can focus directly on the development.
The key deliverable for this project are listed below:
- Design a consistent, unified and easy to use API for Drag and Drop features which can be used for all SWT widgets. Propose the idea in the community and act accordingly on suggestions/ideas.
- Write tests as a specification of design in order to stress the API.
- Implement the Drag and Drop Utility class and extend the widget classes to implement how drag and drop is specifically different for each widget.
- Enhance the recorder to monitor Drag and Drop events and generate the code for the same.
The project consists of three parts : Design – Implement – Test . However, a reverse approach would be followed and tests would be written first in order to specify the design of the API. Once this is approved, only then will the code be written. The timeline for the deliverables are as follows:
June 17 – June 31 : Write several tests which specify the proposed API implementation. Propose the design to the community and make changes and arrive at a consensus based on majority. More than one API may be proposed, if time permits.
July 1- July 23 : Understand the way SWT handles native UI actions. Define and introduce a utility class which takes care of Drag thresholds and delay along with providing the implementation of the API.
July 24-August 14 : Extend the individual widget classes in org.eclipse.swtbot.swt.finder.widget to provide the widget-specific drag and drop functionality.
August 15- August 31 : Extend the org.eclipse.swtbot.generator plugin so it can monitor and generate the Drag and Drop events.
Sept 1 – Sept 17 : Test the Drag and Drop feature on different platforms (Windows , Linux, Mac) . (I can test myself on Windows and Linux). Do final optimizations and revisions to the code. Push the code to Gerrit for review. Handle any bug that might be raised.
Even though this is fair amount of work, I am confident that we’ll be able to complete it. From my side, 40-50 hours of work per week is guaranteed as this is my only commitment for the entire duration of the summer and I will treat like any other full time internship with utmost seriousness.
I hope to develop a good working equation with my mentor Mr Mickael Istria. I’ll try and work through the project under the guidance of my mentor and consult him in case of ambiguity or roadblock (only when I have tried my best to work through the problem myself). This would ensure maximum learning on my part and would also ensure that I am able to use my innovation and creativity to give my best to the project. Any extra learning resources that I might need, I’ll consult with my mentor for the best possible source so I have to waste minimal time on finding the best resource to read up. I hope to become proficient with Eclipse plug in development and SWTBot after this project.
My contact information is as follows :
Name : Rohit Agrawal
Institute : Nanyang Technological University, Singapore
Where I will be in Summer : Lucknow , India
Phone : +65 93232726 , +91 9044145746
I am a 4th year undergraduate student at Nanyang Technological University , majoring in Electrical and Electronic Engineering and specializing in Intelligent System Design and Control Engineering. I am also pursuing a Minor in Computing. I was a GSoC participant under The Eclipse Foundation the last time as well and I want to take part again because of the great experience I had last summer. Eclipse Open Source community is really very helpful and eager to help in case of any issues. I also hope to be able to contribute to SWTBot even after the program is over.
Prior to this, I have done an internship in Bank of America Merrill Lynch , Singapore as a QA Analyst in the Electronic Trading Technology team. I am familiar with many programming languages like Java, C++, Perl, Python, Processing etc. I am proficient in usage of most of the data structures and good at algorithms . I am familiar in working on both Windows and Linux operating systems.