Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Functional Testing made easy
with SWTBot for Developers
and Testers
Aurelien Pupier - @apupier
Studio Development Leader
©...
What is SWTBot?
Java Framework for SWT automated UI tests
© 2015 Bonitasoft 3
And also…
SWTBot – General workings
• Encapsulate UI components
• Send SWT Events to simulate User interaction
4© 2015 Bonitasoft
SWTBot – Sample
5© 2015 Bonitasoft
bot.textWithLabel(“Name *”).setText(“userName”);
bot.comboBox().select(“Text”);
bot.tex...
SWTBot – Advantages
• Easy to understand for developers
• Easy to write first shot
• … Even a recorder
• Access to Java AP...
SWTBot limitations (1/5)
• Underlying components knowledge
– Widget types
– Eclipse wording
7© 2015 Bonitasoft
Table or Li...
SWTBot limitations (2/5)
• Same widget at different place
– SWTBotConstants.SWTBOT_WIDGET_ID_KEY
– production code modifie...
SWTBot limitations (3/5)
• UI Thread synchronization  Robustness hard:
– Correct implementation of waitUntil required
– (...
SWTBot limitations (4/5)
• Java code not accessible for Java/Eclipse beginners
– For all previously mentioned reasons
10© ...
SWTBot limitations (5/5)
• Maintenance of tests:
– Requires to be close to production code
• Message updated (to fix a typ...
SWTBot conclusion
SWTBot is an handy test tool
for developers
12© 2015 Bonitasoft
What about testers?
• How to let testers writing Functional tests?
– Do not care of implementation details
13© 2015 Bonita...
Application Oriented API
‘Page Object Pattern’
14© 2015 Bonitasoft
Application Oriented API
15© 2015 Bonitasoft
Page Pattern sample (1/2)
16© 2015 Bonitasoft
new BotDataDialog().
.setName(“userName”)
.setType(“Text”)
.setDefaultValue(...
Page Pattern sample (2/2)
17© 2015 Bonitasoft
new BotDataDialog().
.setName(“userName”)
.setType(“Text”)
.setDefaultValue(...
What decided us?
• Successful implementation with Selenium and
Chinese QA team
• Code mess
– Big static utility classes…
–...
Observed benefits
Eases writing…
… and maintaining Functional Tests
… for Testers AND Developers
– New UI test: Half-day ...
Feedback on implementation
• Setup time ~3 weeks
• On the fly
20© 2015 Bonitasoft
What’s next?
21© 2015 Bonitasoft
What’s next?
• BDD
– Get stake holders and user advocates to join the party
– Talk about using Cucumber with SWTBot
• RedD...
Visit us online
bonitasoft.com
Join our community
Bonitasoft.org
Download
Bonitasoft.com/downloads
Follow us on twitter
@b...
24© 2015 Bonitasoft
Upcoming SlideShare
Loading in …5
×

Functional Testing made easy with SWTBot for Developers and Testers

1,083 views

Published on

Functional Testing made easy with SWTBot for Developers and Testers

Published in: Software
  • Be the first to comment

Functional Testing made easy with SWTBot for Developers and Testers

  1. 1. Functional Testing made easy with SWTBot for Developers and Testers Aurelien Pupier - @apupier Studio Development Leader © 2015 Bonitasoft 2
  2. 2. What is SWTBot? Java Framework for SWT automated UI tests © 2015 Bonitasoft 3 And also…
  3. 3. SWTBot – General workings • Encapsulate UI components • Send SWT Events to simulate User interaction 4© 2015 Bonitasoft
  4. 4. SWTBot – Sample 5© 2015 Bonitasoft bot.textWithLabel(“Name *”).setText(“userName”); bot.comboBox().select(“Text”); bot.textWithLabel(“Default value”).setText(“john”); bot.button(“Finish”).click();
  5. 5. SWTBot – Advantages • Easy to understand for developers • Easy to write first shot • … Even a recorder • Access to Java API for assertions • Test code coverage 6© 2015 Bonitasoft
  6. 6. SWTBot limitations (1/5) • Underlying components knowledge – Widget types – Eclipse wording 7© 2015 Bonitasoft Table or List? Combo or CCombo?
  7. 7. SWTBot limitations (2/5) • Same widget at different place – SWTBotConstants.SWTBOT_WIDGET_ID_KEY – production code modified 8© 2015 Bonitasoft
  8. 8. SWTBot limitations (3/5) • UI Thread synchronization  Robustness hard: – Correct implementation of waitUntil required – (even if Conditions provided) 9© 2015 Bonitasoft
  9. 9. SWTBot limitations (4/5) • Java code not accessible for Java/Eclipse beginners – For all previously mentioned reasons 10© 2015 Bonitasoft
  10. 10. SWTBot limitations (5/5) • Maintenance of tests: – Requires to be close to production code • Message updated (to fix a typo) • UI updated (from Combo to CCombo…) 11© 2015 Bonitasoft
  11. 11. SWTBot conclusion SWTBot is an handy test tool for developers 12© 2015 Bonitasoft
  12. 12. What about testers? • How to let testers writing Functional tests? – Do not care of implementation details 13© 2015 Bonitasoft
  13. 13. Application Oriented API ‘Page Object Pattern’ 14© 2015 Bonitasoft
  14. 14. Application Oriented API 15© 2015 Bonitasoft
  15. 15. Page Pattern sample (1/2) 16© 2015 Bonitasoft new BotDataDialog(). .setName(“userName”) .setType(“Text”) .setDefaultValue(“john”) .finish(); bot.waitUntil(Conditions.shellIsActive(Messages.newVariable)); SWTBotShell shell = bot.activeShell(); bot.textWithLabel(Messages.name_mandatory).setText(“userName”); bot.comboBox().select(“Text”); bot.textWithLabel(Messages.defaultValue).setText(“john”); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.waitUntil(Conditions.shellCloses(shell));
  16. 16. Page Pattern sample (2/2) 17© 2015 Bonitasoft new BotDataDialog(). .setName(“userName”) .setType(“Text”) .setDefaultValue(“john”) .finish(); bot.waitUntil(Conditions.shellIsActive(Messages.newVariable)); SWTBotShell shell = bot.activeShell(); bot.textWithLabel(Messages.name_mandatory).setText(“userName”); bot.comboBox().select(“Text”); bot.textWithLabel(Messages.defaultValue).setText(“john”); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.waitUntil(Conditions.shellCloses(shell));
  17. 17. What decided us? • Successful implementation with Selenium and Chinese QA team • Code mess – Big static utility classes… – Sometimes right utility class hard to find • Robustness issue – CI infra updated  ~10% of UI tests unstable • Half-day for one test • Invite QA testers to join the party • Same tooling Development/QA 18© 2015 Bonitasoft
  18. 18. Observed benefits Eases writing… … and maintaining Functional Tests … for Testers AND Developers – New UI test: Half-day  1 hour – More factorized code – Robustness 19© 2015 Bonitasoft
  19. 19. Feedback on implementation • Setup time ~3 weeks • On the fly 20© 2015 Bonitasoft
  20. 20. What’s next? 21© 2015 Bonitasoft
  21. 21. What’s next? • BDD – Get stake holders and user advocates to join the party – Talk about using Cucumber with SWTBot • RedDeer – Reuse the Eclipse components 22© 2015 Bonitasoft
  22. 22. Visit us online bonitasoft.com Join our community Bonitasoft.org Download Bonitasoft.com/downloads Follow us on twitter @bonitasoft “Page” your App! @apupier © 2015 Bonitasoft 23
  23. 23. 24© 2015 Bonitasoft

×