Here are some news from SWTBot, the famous SWT UI Bot API that’s widely used in order to write some functional tests!
A Test Recorder and Generator
Together with Rastislav Wagner (who’s a Red Hat colleague working on testing JBoss Tools and JBoss Developer Studio), we had the opportunity to meet in person with the whole JBoss Tools team in Brno. We started to work on a draft of a test recorder and generator that could work for both SWTBot, and an Eclipse bot API used by Brno folks called RedDeer.
We made so much progress that we did not simply sketch a way to get it to work; but in the end, we wrote a first simple version of the generator. It’s quite simple, but it’s already powerful enough to be useful, so we decided to contribute it to SWTBot.
For more details about the contribution process, you can follow those links: Gerrit contribution (thanks to Matthias Sohn for reviewing it), disucssion on the developer mailing-list, discussion on user forum, and finally the Git commit in the source repository.
All this stuff leads us to the ability to install this recorder from the SNAPSHOT p2 repository: http://download.eclipse.org/technology/swtbot/snapshots/
Once installed on any RCP application, it’s pretty easy to use: just set the -Dorg.eclipse.swtbot.generator.enable=true system property. The following video shows a basic use-case
It’s currently limited to a few concepts, but it’s easy to add support for new widgets, and it can already be used to save a lot of time when writing tests. If you feel interested in contibuting, see http://wiki.eclipse.org/SWTBot/Contributing and come to the swtbot-dev mailing-list to have a chat.
Rastislav already has plans to implement support for more complex UI operations that match several events, that will be a very interesting to implement and powerful to use improvement!
Support for Eclipse 4
SWT has not changed much between Eclipse 3.x and Eclipse 4, so SWTBot still supports most SWT concepts There are very few bugs that are known, but there is no blocker. The most critical one is probably related to the visibility of some menus. Any help to fix one of these bugs is highly welcome.
However, there is an important bug that prevents UI tests (may them use SWTBot or not) from being run with PDE for an Eclipse 4 application. So it’s difficult to test SWTBot for Eclipse 4 from IDE. Fortunately, Tycho, which is more “regular”, is able to run tests that use SWTBot on an e4 application. You can give it a try by configuring the product in tycho-surefire-plugin to use an e4 product (such as the contact demo) and use SWTBot in your tests. Make sure e4 bundles are present during tests (they must either be a transitive dependency of the test -recommanded-, or you can add them as dependencies of test execution).
I think once all the SWTBot for e4 are fixed, we’ll try to make an official release of SWTBot.
SWTBot is an open project!
SWTBot is a community-engaging project: there is activity on the user forum, on the developer mailing-list, the wiki makes it easy to learn how to use SWTBot, but also how to contribute. SWTBot excels in the use of Git, Gerrit, Hudson, Sonar… All those tools are there to make it easier for users to turn into contributors, and contributors into committers, and to keep productivity and quality at a high level; and they’ve proven there efficiency on these topics in the last few months. They provide so much feedback on contributions that the process of accepting a patch is made faster.
So if you’re interested in contributing, please give it a try and feel free to ask for help on the developer mailing-list. The tools and processes are open as well, so please come and suggest better ways of doing things, it will be very appreciated!