Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Testing Any Website Written in Any Language With Capybara and RSpec

Testing Any Website Written in Any Language With Capybara and RSpec

Presented at Barcamp Bangkhen 2014 on November 16, 2014.

F1c4a3bb1606cc4a61711e61e2fe6146?s=128

Prem Sichanugrist

November 16, 2014
Tweet

More Decks by Prem Sichanugrist

Other Decks in Technology

Transcript

  1. Testing Any Website Written in Any Language With Capybara and

    RSpec
  2. Prem Sichanugrist @sikachu /sikachu

  3. Testing

  4. Acceptance Testing

  5. High-level Testing

  6. Assert From User's Perspective

  7. Whole-Stack Testing

  8. Acceptance Testing Frameworks • Cucumber (Ruby) • Mocha (JavaScript (node.js))

    • Ranorex (C#, VB.NET)
  9. Capybara + RSpec (Ruby)

  10. Why You Should Write Acceptance Test

  11. (this slide is intentionally left blank)

  12. TL;DR • User flow is well-defined • Prevent future regression

    after introducing new feature
  13. Why Capybara + Rspec?

  14. Clean & Clear Syntax

  15. Very Well-Maintained

  16. Very Flexible Easily swapping between drivers

  17. Requirements

  18. Requirements 1. RSpec - Testing Framework

  19. Requirements 1. RSpec - Testing Framework 2. Capybara - Providing

    DSL for Testing
  20. Requirements 1. RSpec - Testing Framework 2. Capybara - Providing

    DSL for Testing 3. Capybara Webkit - Webkit Backend with JS support
  21. Demo

  22. Steps • Install dependencies using Bundler • RSpec, Capybara, Capybara

    Webkit • Run RSpec install • Require Capybara in spec_helper • Set Webkit as the driver • Done, start writing test!
  23. http://git.io/bcbk-testing Demo Source Code

  24. Before we're done ... • Bangkok.rb • Metting every last

    Saturday afternoon • http://bit.ly/bangkokrb (Google Groups) • November Meeting - November 29, 2014 • Sign up: http://bit.ly/bangkokrb-nov2014
  25. Thank You! Any Questions? Code: http://git.io/bcbk-testing Slide: http://bit.ly/bcbk-testing Follow me:

    https://twitter.com/sikachu