Cédric Brun bio photo

Cédric Brun

Build open-source technologies to enable mission critical tools for complex domains.

Email Twitter LinkedIn Github Youtube

In my never-ending quest of ideas or tools to avoid doing boring stuff (that sacred goal explains my interest in pragmatic modeling), I made quite a victory today thanks to one of those gems you find in Eclipse.

Here I'm speaking about the help/tutorials you get in the Eclipse help menu.

We often add many many screenshots in the tutorial but this tiny litle idea of "showing stuff to the user" may have a huge cost ! The drawback of using such images in the help is that as the tool evolve the ui do so, and the tutorial screenshots are quickly really different from the real tool user interface. Then you even have to recapture screenshots for at every release, or just decide that " a real doc has no screenshots "

Both are inadmissible, one idea would be to integrate this "screen capture" step in the build process and automatically capture the wizards, views or properties. Then, you would even be able to localize your documentation screenshots starting this process for every localization you have. You've got pretty much any thing you need, right now thanks to Eclipse, to do that.

The gem I mentioned is SWTBot , thanks to this litle tool I quickly managed to get a basic test scenario working to test UI. Even if testing is important, and testing UI is tricky, here my goal was to produce the screenshots from the tests, here is the code (it anybody knows how to highlight code with blogger...):


bot.view("Welcome").close();

bot.menu("Window").menu("Open Perspective").menu("Other...").click();
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
openPerspectiveShell.activate();

bot.table().select("Acceleo");
captureScreenshot("1-switch-perspective.png");
bot.button("OK").click();


bot.menu("File").menu("New").menu("Project...").click();
SWTBotShell newProjectShell = bot.shell("New Project");
newProjectShell.activate();
bot.tree().expandNode("Acceleo").getNode("Generator Project").select();
captureScreenshot("2-new-generator-project.png");


bot.button("Next >").click();
bot.text().setText("org.acceleo.uml2.gen.java");
captureScreenshot("3-new-generator-step1.png");


bot.button("Finish").click();

bot.waitUntil(Conditions.shellCloses(newProjectShell));
captureScreenshot("4-generator-project-done.png");


bot.menu("File").menu("New").menu("Empty Generator").click();
SWTBotShell newTemplateShell = bot.shell("New");
newTemplateShell.activate();
captureScreenshot("5-new-template-wizard.png");


bot.comboBox().setSelection("https://www.eclipse.dev/uml2/2.1.0/UML");
bot.comboBox(1).setSelection("uml.Class");
captureScreenshot("6-new-template-wizard-full.png");

That's the 喜喜 (ShuangXi) effect, you roughly test your UI and you get your screenshots !

ps : special "Hi" to the unique Guangzhou visitor I had on this blog so far :)