• Save
SWTBot
Upcoming SlideShare
Loading in...5
×
 

SWTBot

on

  • 1,925 views

Présentation de SWTBot en français

Présentation de SWTBot en français

Statistics

Views

Total Views
1,925
Views on SlideShare
1,921
Embed Views
4

Actions

Likes
0
Downloads
1
Comments
0

1 Embed 4

https://twitter.com 4

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

SWTBot SWTBot Presentation Transcript

  • Eclipse Party 2011 SWTBot Mariot Chauvin Obeo, Francecopyright 2011 Obeo
  • Unit tests
  • Functional tests
  • Functional tests manual vs automatic
  • Manual functional tests
  • UI tests
  • Controls finding
  • Threads management ● Tests non bloquants ● Exécution dans un thread à part ● Gestion de la synchronisation
  • Threads managementStandard JUnit test is launched in the UI thread/** * Wait the end of the asynchronous calls waiting in UI thread. */public static void synchronizationWithUIThread() { while (PlatformUI.getWorkbench().getDisplay().readAndDispatch()) { // Do nothing, just wait }}
  • SWTBot
  • SWTBot features ● API de type Fluent ● Integration avec JUnit ● Gestion des threads ● Gestion des évenements SWT ● Support de GEF ● Support de Eclipse forms
  • SWTBot example @Testpublic void canCreateANewJavaProject() throws Exception { bot.menu("File").menu("New").menu("Project...").click(); SWTBotShell shell = bot.shell("New Project"); shell.activate(); bot.tree().select("Java Project"); bot.button("Next >").click(); bot.textWithLabel("Project name:").setText("MyFirstProject"); bot.button("Finish").click();}
  • SWTBot Widgets ● Wrapper : API fluent et gestion des threads ● Exécution synchrone des requêtes ● Exécution asynchrone des commandes
  • SWTBot Matchers ● Utilisation de Hamcrest ● Création de regles de correspondance ● Bot.widget( WidgetMatcherFactory.widgetOfType(StyledText.class), composite);
  • Matchers creation ● Utilisation de WidgetMatcherFactory ● withText(“Finish”) ● withLabel(“Username”) ● withRegex(“Proceed to step (.*)”) ● widgetOfType(Button.class) ● withStyle(SWT.ARROW, “SWT.ARROW”) ● withTooltip(“Enable to drink”)
  • Matchers combination ● allOf(matchers...) ● anyOf(matchers…) ● not(matcher) ● allOf(anyOf(matchers…), matchers...)
  • SWTBot conditions ● Ecriture de test robustes et fiables ● Eviter dutiliser wait(long time) ● Utiliser waitUntil(ICondition condition)
  • Tips
  • Logging ● Utilisation de log4j ● Pensez à lactiver ● Voir la FAQ pour lactivation
  • Screenshots ● Un réalisé par erreur ● Pratique pour debugger
  • Timeout ● Temps dattente pour les conditions ● Modifiable globalement ou localement ● SWTBotPreferences.TIMEOUT
  • Need a tutorial ? http://bit.ly/uLsBJ
  • Thanks Questions ??
  • Copyright SXC - http://www.sxc.hu/txt/license.html● Boxing gloves : http://www.sxc.hu/photo/901672● Camera : http://www.sxc.hu/photo/733375● Watch : http://www.sxc.hu/photo/1154499● Bots : http://www.sxc.hu/photo/914512 and http://www.sxc.hu/photo/914514● Book : http://www.sxc.hu/photo/634335