Graceful Failure with Selenium and Continuous Integration

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    Graceful Failure with Selenium and Continuous Integration - Presentation Transcript

    1. FAILING GRACEFULLY with Selenium and T.D.D.
    2. FAILURE
    3. IT’S A WAY OF LIFE
    4. OBVIOUS FAILURE
    5. PREDICTABLE
    6. SURPRISE
    7. GRACEFUL
    8. HOW TO COPE?
    9. DENY IT
    10. JUST BE VAGUE
    11. GO ON THE OFFENSIVE
    12. STALL FOR TIME
    13. Better strategies? maybe just .... CLEARER INSTRUCTIONS!
    14. FAILURE IS NATURAL.
    15. Good, even.
    16. Good, even. (fail) (win)
    17. AS PROGRAMMERS we fail all the time.
    18. The only way to fail less is to ANTICIPATE FAILURE
    19. The only way to fail less is to ANTICIPATE FAILURE and then DON’T MAKE THE SAME MISTAKE AGAIN :)
    20. THINGS HAPPEN.
    21. BUT THEN ...
    22. AND THEN ...
    23. AND, WELL ...
    24. TESTING CAN HELP.
    25. HUMAN Q.A. TESTING is the ideal. (Too bad humans are so much better at other things and need to eat and sleep and stuff ... )
    26. SELENIUM IS A tool for helping to automate testing.
    27. ACTUALLY... There are many kinds of automated tests http://www.flickr.com/photos/60648084@N00/1360619915/
    28. UNIT TESTS * For individual functions * The cutest test. http://www.flickr.com/photos/donsolo/2900765675/in/set-72157594163175020/
    29. INTEGRATION TESTS * For groups of related functionality * More relevant and (almost) fun to write http://www.flickr.com/photos/donsolo/399501571/in/set-72157594163175020/
    30. ACCEPTANCE TESTS * Highest level testing. * Basically user stories. * “Accepted” as in “get fired if they don’t work” http://www.flickr.com/photos/donsolo
    31. don’t get confused: REGRESSION TESTING (Is part of all of these, not another style)
    32. So, let’s back up a sec. Let me tell you a story about ... UNIT TESTING IN RUBY http://www.flickr.com/photos/21734563@N04/2198268918/
    33. ASSERT
    34. svn ci -m “math library passes unit tests!!”
    35. Integration testing is super cool
    36. You can really smell the relevance. (seriously)
    37. HOORAY FOR USER STORIES! Strive to pass good user-centered tests. http://www.lukeredpath.co.uk/blog/developing-a-rails-model-using-bdd-and-rspec-part-1.html
    38. B.D.D. = BEHAVIOR DRIVEN DEVELOPMENT in rspec
    39. (which uh, actually runs)
    40. WAIT: IT’S IMPORTANT HOW YOU DO IT!!
    41. http://atlalt.net/screwturn/MTG-2008-07-23%20Pub%20Night.ashx
    42. http://blog.briandicroce.com/2008/03/14/three-index-cards-to-easily-remember-the-essence-of-test-driven-development/
    43. RIGHT. SO, ANYWAY ... BACK TO THIS SELENIUM THING
    44. SELENIUM IS INCREDIBLY...
    45. WEIRD
    46. why: It’s a Firefox plugin for testing. Turns your actions into test code. Let’s you edit test code in the browser. Let’s you export to lots of languages.
    47. FUN
    48. why: It’s a Firefox plugin for testing. Turns your actions into test code. Let’s you edit test code in the browser. Let’s you export to lots of languages.
    49. POWERFUL
    50. why: It’s a Firefox plugin for testing. Turns your actions into test code. Let’s you edit test code in the browser. Let’s you export to lots of languages.
    51. FIRE-FOXY AND SIMPLE Start here: http://seleniumhq.org/
    52. (then go here) HTTP://SELENIUMHQ.ORG/DOCS/
    53. no forget about that LETS JUST WRITE A TEST ALREADY!
    54. Now: Record and Playback • Intelligent field selection will use IDs, names, or XPath as needed • Autocomplete for all common Selenium commands • Walk through tests • Debug and set breakpoints • Save tests as HTML, Ruby scripts, or any other format Totally takes 5 seconds, man
    55. Watch this video:
    56. GO RED
    57. (WRITE MORE CODE)
    58. THEN GO GREEN
    59. SPEAK SELENESE open opens a page using a URL. click/clickAndWait performs a click operation, and optionally waits for a new page to load. verifyTitle/assertTitle verifies an expected page title. verifyTextPresent verifies expected text is somewhere on the page.
    60. VERIFY PAGE ELEMENTS is ... 1. an element is present somewhere on the page? 2. specific text is somewhere on the page? 3. specific text is at a specific location on the page?
    61. GOTCHAS • clickAndWait is usually required • type usually requires you to click somewhere else first • it’s slow • brittle if the UI is changing rapidly
    62. HARD PART’S JUST FINDING IT Good thing you have so many options ... • find elements by name • find them by id if they have it • or with CSS selectors if you understand the cascade • Xpath is like a buzzsaw (a little more expensive) • link text as a last resort (since it changes often)
    63. Now, SELENIUM IDE is not the same as SELENIUM RC
    64. IDE and RC play great together!
    65. RC Remote Control, that is. • Runtests in multiple browsers. • Runthem remotely (on a dedicated server) • Runthem whenever you check in code!
    66. exported test to c#
    67. exported test in java
    68. exported test to ruby
    69. Selenium-RC leverages the full power of programming languages, creating tests that can do things like • read and write external files, • make queries to a database, • send emails with test reports • practically anything else a user can do with a normal application ...
    70. RC can where IDE can’t • condition statements • iteration • logging and reporting of test results • error handling, particularly unexpected errors • database testing • test case grouping • re-execution of failed tests • test case dependency • capture screenshots on test failures
    71. WAIT, WHAT ABOUT TEST- DRIVEN DEVELOPMENT? If you click around the app to build a test, that can’t be testing before development.
    72. RIGHT. You actually should write them beforehand, by hand, just like you would unit tests. It’s not so scary. • NUnit for C# • Junit for Java • Selenium gem for Ruby
    73. PUT IT ALL TOGETHER
    74. Put it on your SVN server trigger it with SVN hooks
    75. Continuous Integration with Selenium and Criuse Control
    76. WHAT IT MEANS • Run your unit tests first locally (because they’re fast). • Checking in your changes triggers the continuous integration server running your Selenium tests (slow because they are in the browser). • Cruise Control gives you a web-based heads up when you fail or pass tests. • Joy.
    77. THANKS! :) Chris Blow http://unthinkingly.com User Experience @ Meedan.net

    + unthinkinglyunthinkingly, 4 months ago

    custom

    430 views, 2 favs, 0 embeds more stats

    An overview of the why and how of automated softwar more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 430
      • 430 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 20
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories