When it comes to user interface testing in Eclipse, I’m a big fan of SWTBot. I had some long plane rides recently and a need to add some functionality to SWTBot so I decided to see if I could tackle an outstanding feature request in SWTBot to add Eclipse Forms support. On top of that, I also had a selfish reason to learn more about the internals of SWTBot. After forking Ketan’s copy of SWTBot on GitHub, I pushed my changes which adds an SWTFormsBot class as the primary handle to drive user interface tests.
So your test code would look something like this…
| public class SWTBotImageHyperlinkTest extends AbstractSWTBotFormsTestCase { @Test public void findImageHyperlink() throws Exception { FormView view = new FormView(shell); SWTFormsBot = new SWTFormsBot(); SWTBotImageHyperlink link = bot.imageHyperlink("Image link with no image"); assertNotNull(link); assertEquals("Image link with no image", link.getText()); } } | 
We’re looking to eventually integrate this into SWTBot proper, just pay attention to this bug if you’re interested.
Enjoy.


