Cela faisait longtemps que je recherchais de quoi tester mes vues et mes dialogues sous eclipse. swtbot permet de le faire simplement.

Exemple de test : (un dialogue avec un CLabel et un Tree)

public class ItemSelectionDialogTest extends TestCase {

	public void testConnected() throws Exception {
		SWTEclipseBot bot = new SWTEclipseBot();
		SWTBotShell botShell = bot.shell("Java - Eclipse SDK");
		Display display = Activator.getStandardDisplay();
		final ItemSelectionDialog itemSelectionDialog = new ItemSelectionDialog(
				(Shell) botShell.widget);
		UIThreadRunnable.asyncExec(display, new UIThreadRunnable.VoidResult() {
			public void run() {
				itemSelectionDialog.open();
			}
		});
		bot.shell("Item Selection").activate();
		SWTBotTree botTree = bot.tree();
		assertTrue(botTree.rowCount() > 1);
		SWTBotCLabel botCLabel = bot.clabel("none");
		assertNull(botCLabel.getImage());
		botTree.getTreeItem("Alfresco2").expand().select("Guest Home");
		botCLabel = bot.clabel("Guest Home");
		assertNotNull(botCLabel.getImage());
		bot.button("OK").click();
		Item item = itemSelectionDialog.getSelectedItem();
		assertNotNull(item);
		assertEquals("Guest Home", item.getName());
	}
}

SWTBot est encore récent mais il parait vraiment bien fait. L'auteur a présenté SWTBot à l'eclipsecon2008