Where he blogs about his eclipse musings
Posts tagged swtbot
GEF Support for SWTBot
Aug 4th
A long pending request from swtbot users has been support for GEF. The SWTBot4GEF project was created as a sandbox to see how feasible things were in the GEF world.
Mariot Chauvin recently polished the initial contribution from David Green and released a version 0.1 of the gef support. We’re working towards integrating this as part of swtbot and you should hear more about it once the IP process is done
SWTBot Getting Started Video Tutorials
Jul 15th
Getting started with SWTBot is a unique experience for a lot of users, and myself. Unlike most other projects hosted at eclipse.org, it’s a UI testing tool written for primarily for testers to be able to write automated tests.
In this regard the users of swtbot are a bit special. Most of them understand testing and the principles associated with testing but do not necessarily understand swt, threading models and the workbench and platform internals. Getting such users to use eclipse, create test plugins and write tests in java involves more than just documentation and screenshots.
Mohammed recently posted two such 5 minute videos. Getting started with swtbot in under 5 minutes, and run your UI tests in a headless build from within ant.
A video is worth a thousand images
Eclipsetasy! Time to throw away the dope…
Jun 19th
… and move to newer dope…
I just realized that I had about 58 eclipse SDKs downloaded on my hard drive and 22 instances of different versions of eclipse. That was a whooping 9GB for the sdk downloads and 6.5GB for the extracted versions. Time to move to newer dope
Similar was the case on the cruise based build grid that tested SWTBot from all versions starting from eclipse 3.2 upwards to the latest RC build on all platforms — linux-gtk/linux-gtk-64/win32/macosx-carbon.
Announcing a new release of SWTBot
May 29th
You can download the latest and greatest from the SWTBot download page.
A listing of some of the new features available:
Bug 263036 – SWTBot finally has an icon that was missing since two years!
Bug 269919 – Added support for toggle buttons
Bug 271246 – Better support for handling editors. This should serve as a good start towards providing support for multipage, forms based editors
Bug 271132 – Using Display#post() to support sending native click events instead of fake events. This is still work in progress and not all widgets support native events yet.
Bug 273624 – Use native keyboard events for typing. SWTBot currently defaults to using AWT robot. SWT’s Dispay#post() is available as well — it is however buggy across platforms and swt versions. Since SWTBot uses native keyboard events, it needs to understand various Keyboard Layouts.
Bug 267189 – Support capturing screenshots of widgets.
Bug 277093 – Support for Link widgets.
There are also a lot of minor bugs that were fixed in this release.
SWTBot has moved to eclipse.org!
Dec 3rd
SWTBot has finally moved to eclipse.org.
There is a bit of documentation sitting at the old home that needs to move to eclipse.org. I’m hoping to move this over in the next couple of days.
The sourcecode will also move during the course of the week. I’m busy renaming plugin IDs and packages to use the org.eclipse.swtbot namespace. Meanwhile you can participate on the newsgroups.
Cheers!
SWTBot Proposal at Eclipse.org
Sep 6th
SWTBot 1.2.0 released
Aug 30th
For the impatient:
Direct download link: https://sourceforge.net/project/showfiles.php?group_id=188411&package_id=220519&release_id=622752
Update site: http://swtbot.sourceforge.net/latest/update-site/
SWTBot 1.2.0 is the 3rd of the 1.x releases of SWTBot was released last night, and there have already been about 200 downloads by the time of writing this blog post.
SWTBot has always believed in release early release often mantra, and pushes out nightly builds out of CruiseControl. From the download stats I’m looking at, there are more downloads of the nightly build than the ’stable’ available on the sourceforge mirrors.
The highlight of the release is support for view menus and view toolbar.
Thanks to the contributors and adoptors, for patches, criticism, and suggestions for improvement. The release has fixed about 42 issues.
Read more on the detailed release notes and the changelog.
Reusing Functional Tests – Part 1
Jun 21st
While writing some tests for SWTBot, there was quite some code duplication that could be removed by using some simple test patterns. This is part of a series of articles about how test code could be written better. This example uses SWTBot as a driver to drive an Eclipse application used by ACME Corporation.
Here is a snippet of a Test Case that creates an account in ACME Corporation’s customer management system.
public void testCreatesAccount() throws Exception {
bot.menu("Accounts").menu("New").click();
// nice wizard
bot.shell("Create a new account").activate();
bot.textWithLabel("Name:").setText("Will Coyote");
bot.textWithLabel("Email:").setText("will@coyote");
bot.button("Next>").click();
// yet another wizard
bot.shell("Address Details").activate();
bot.textWithLabel("Mailing Address:").setText("Will Coyote, middle of, nowhere");
bot.button("Finish").click();
assertThatAccountIsCreated("Will Cooyte", "will@coyote.com");
}
That’s a great start to begin writing tests. But there’s the problem: What happens if the test fails somewhere and the “Create a new account” or the “Address Details” window remains open ? This means that the rest of the tests fail or do not run at all. Not a problem, tearDown() to the rescue:
protected void tearDown() throws Exception {
closeWindow("Create a new account");
closeWindow("Address Details");
}
private void closeWindow(String windowTitle) throws Exception {
try {
bot.shell(windowTitle).close();
} catch (WidgetNotFoundException e) {
// do nothing if the window is not found
}
}
Now we write a test that tests if you’re able to create two users with the same name.
public void testShouldNotCreateTwoAccountsWithTheSameName() throws Exception {
bot.menu("Accounts").menu("New").click();
// nice wizard
bot.shell("Create a new account").activate();
bot.textWithLabel("Name:").setText("Will Coyote");
bot.textWithLabel("Email:").setText("will@coyote");
bot.button("Next>").click();
// yet another wizard
bot.shell("Address Details").activate();
bot.textWithLabel("Mailing Address:").setText("Will Coyote, middle of, nowhere");
bot.button("Finish").click();
assertThatAccountIsCreated("Will Cooyte", "will@coyote.com");
bot.menu("Accounts").menu("New").click();
// nice wizard
bot.shell("Create a new account").activate();
bot.textWithLabel("Name:").setText("Will Coyote");
bot.textWithLabel("Email:").setText("will@coyote");
bot.button("Next>").click();
// yet another wizard
bot.shell("Address Details").activate();
bot.textWithLabel("Mailing Address:").setText("Will Coyote, middle of, nowhere");
bot.button("Finish").click();
assertThatAccountIsNotCreated("Will Cooyte", "will@coyote.com");
}
Duplication, not a big deal, some bit of refactoring and you get to this. This also reduces the number of places where you’ll need to fix the test, if the label on one of the screens change.
public void testCreatesAccount() throws Exception {
createAccount("Will Coyote", "will@coyote", "Will Coyote, middle of, nowhere");
assertThatAccountIsCreated("Will Cooyte", "will@coyote.com");
}
public void testShouldNotCreateTwoAccountsWithTheSameName() throws Exception {
createAccount("Will Coyote", "will@coyote", "Will Coyote, middle of, nowhere");
assertThatAccountIsCreated("Will Cooyte", "will@coyote.com");
createAccount("Will Coyote", "will@coyote", "Will Coyote, middle of, nowhere");
assertThatAccountIsNotCreated("Will Cooyte", "will@coyote.com");
}
private void createAccount(String name, String email, String snailMail) throws WidgetNotFoundException, TimeoutException {
bot.menu("Accounts").menu("New").click();
// nice wizard
bot.shell("Create a new account").activate();
bot.textWithLabel("Name:").setText(name);
bot.textWithLabel("Email:").setText(email);
bot.button("Next>").click();
// yet another wizard
bot.shell("Address Details").activate();
bot.textWithLabel("Mailing Address:").setText(snailMail);
bot.button("Finish").click();
}
In the next article, you’ll get to see how you can reuse code better by using Screen Objects
Announcing SWTBot 1.0
May 22nd
I just made new release of SWTBot – 1.0
Direct download link: http://sourceforge.net/project/showfiles.php?group_id=188411&package_id=220519&release_id=601136
Update site: http://swtbot.sourceforge.net/latest/update-site/
Some features:
- A recorder API — now you can record SWTBot scripts. Still in beta though.
- Better SWTBot integration in eclipse — now you can run tests within eclipse.
- More API — now you can use more SWT controls using an even richer API.
- More stable than before.
For more details, you can read up on the release notes here.
SWTBot 1.0 out soon…
Apr 29th
So I’ll be doing a release of SWTBot 1.0 sometime soon
After quite some rigorous tests on a real life project I believe it’s now quite stable enough to be called a major release.
A lot of folks have asked me if there’s a way I could provide any intermediate builds as and when fixes are checked in into trunk. To address this issue, I’ll be putting in some build scripts to push builds out of the CruiseControl running at ThoughtWorks.
Watch out for this space for an announcement about this…
What’s next, I hear there’s something called eSWT and eRCP out there, there’s also some search engine company doing something similar
