Test Essentials @mdevcon 2012

350 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
350
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Test Essentials @mdevcon 2012

  1. 1. Test Essentials Developer Perspective
  2. 2. Maxim Zaks @iceX33!zaks@itemis.de
  3. 3. itemis AG MDSD! OpenSource! Eclipse! Agile! Mobile
  4. 4. What‘s your deal? iOS! Android! WP7! WebDeveloper
  5. 5. Why should we test?document your intentions! eat your own dog food!confidence by feedback! safe refactoring! debugging
  6. 6. How can we test?
  7. 7. Test FirstRed, Green, Refactor!Goes perfect with Unit Testing and Pair Programming
  8. 8. Test After White Box Testing! It is better than nothing!!And sometimes even necessary:! Regression Test! Integration Test! Acceptance Test (UI/UX Test)
  9. 9. Test because you have a test phase ! Just don‘t do that!!Code have to be written with Test in mind! Black Box Test = QA
  10. 10. Test to explore ! Example driven development!Update safely to newer versions
  11. 11. What do we need for testing? DSL to define the test!Runner to execute the test! Reports to visualize results
  12. 12. Test Frameworks forms the DSL
  13. 13. xUnit FrameworksClass is a testcase!Each public „test“Method is a singletest!Test case mayhold state, setup Kent Beckand tear downmethods
  14. 14. JUnit / OCUnit http://www.junit.org/
  15. 15. What we should keepin mind using xUnit Test Methods should be atomic, as we don‘t know the order they will be executed! Test methods should be simple. No Conditions and no loops! Method and class names are used for reporting! Consider to use mocking and matching frameworks to make tests more concise
  16. 16. What‘s mocking all about? Unit testing is all about isolation! We wan‘t to test a boss who depend on his assistant! We provide him a spy assistant and monitor how he interacts! Dependency Injection is the concept that let us do isolation in non dynamic language
  17. 17. Mockitohttp://code.google.com/p/mockito/
  18. 18. And what was it with matching?Matchers let us express expectationsin a very concise way!Matchers will generate a prettyreport when expectation is notfulfilled!Matching framework let us defineour own matchers
  19. 19. Hamcrest Matcherhttp://code.google.com/p/hamcrest/
  20. 20. What‘s wrong with xUnitxUnit Frameworks are the basis forTest Driven Development!Perfect from technical perspective!But hard to use for communication(remember: „document yourintensions“)
  21. 21. Behavior DrivenDevelopment It‘s all about Communication! don‘t test! specify your code Dan North
  22. 22. BDD FrameworksThere are two main flavors behindBDD Frameworks:! Describe what you expect it should do (RSpec family)! Given/When/Then (Cucumber family)
  23. 23. describe what youexpect it should do Internal DSL which let you write executable or pending specifications! Good fit for Unit testing! Comes with mocking and matching solutions inside! Let you define nonlinear context creation
  24. 24. Jasmine Spechttp://pivotal.github.com/jasmine/
  25. 25. Kiwihttps://github.com/allending/Kiwi
  26. 26. Given/When/ThenBreaks down into:! Feature! User story! Scenario! Steps (Given/When/Then)
  27. 27. External DSLGiven/When/Then frameworkswork perfectly with external DSLs!These frameworks can evaluatePlain Text, Wiki Pages or Excelspread sheets and execute the steps
  28. 28. Scenario definition
  29. 29. JBehave Steps http://jbehave.org/
  30. 30. Let‘s sum up onTesting Frameworks xUnit Frameworks (with handy helpers)! Describe what you expect it should do! Given/When/Then! And as always there is one more thing, UX/UI Testing
  31. 31. UI Test Framework Selenium! KIF! UIAutomation! Zucchini Framework
  32. 32. UX / UI TestingLaunch the application in the runtime!Select UI element!Perform actions!Wait for UI component to appear!Assert visual or structuralappearance
  33. 33. One small advice:If you can record and replay a test case. Just Don‘t!
  34. 34. Zucchini Frameworkhttp://www.zucchiniframework.org/
  35. 35. Zucchini Framework
  36. 36. Zucchini Report
  37. 37. Zucchini Report
  38. 38. I hope I couldconvince you thatTest is important and exciting
  39. 39. Some concepts asMilitary Metaphors
  40. 40. Leave no men behind 100% code coverage
  41. 41. Protect your rear (back)Test protects you from butterfly effect
  42. 42. Sniper vs. Cluster Bomb Unit vs. Integration Test
  43. 43. Q&A
  44. 44. Thank you!!! We are consulting :)

×