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

Brownie

 Brownie

Brownie - Browser integration framework inspired by Capybara / Yokohama.pm #8

Avatar for Masaki Nakagawa

Masaki Nakagawa

November 18, 2011
Tweet

More Decks by Masaki Nakagawa

Other Decks in Programming

Transcript

  1. Perl Testing Consideration (seen from other languages) Masaki Nakagawa YAPC::Asia

    Tokyo 2011 (yapcasia.org/2011/talk/80) 2011೥11݄18೔༵ۚ೔
  2. Rails Testing • Perspective • UnitTest, End-to-End • Frameworks •

    Test::Unit (+ Shoulda), RSpec, Cucumber • Browser Integration • Capybara (rack-test, Selenium, Envjs, ...) • Test Double • rspec-mocks, rr, WebMock 2011೥11݄18೔༵ۚ೔
  3. Weakness • Expectation and Verification • vs. rr, rspec-mocks, mocha,

    ... • Browser Integration API • vs. Capybara, Webrat, ... • Naming of Test Double modules • Test::Mock::Guard is “Stub” module 2011೥11݄18೔༵ۚ೔
  4. Comparision • Pros • TAP-based Test Description • Many Helpful

    Modules • Cons • Non-Uniform Browser Integration • Poor Expectation and Verification 2011೥11݄18೔༵ۚ೔
  5. Capybara simulates how a real user would interact with a

    web application. It is agnostic about the driver running your tests and currently comes with Rack::Test and Selenium support built in. 2011೥11݄18೔༵ۚ೔
  6. within("#session") do fill_in 'Login', :with => '[email protected]' fill_in 'Password', :with

    => 'password' end click_link 'Sign in' 2011೥11݄18೔༵ۚ೔
  7. DSL Style (Not yet) use Brownie::DSL; visit ‘http://example.com/’; fill_in Login

    => '[email protected]'; fill_in Password => 'password'; click_link 'Sign in'; 2011೥11݄18೔༵ۚ೔
  8. Vocabulary visit, current_url, current_path, status_code, response_headers, title, source, screenshot, click_link,

    click_button, click_on, fill_in, choose, check, uncheck, select, unselect, attach_file, execute_script, evaluate_script, find_element, find_elements, 2011೥11݄18೔༵ۚ೔
  9. Future • Mechanize Driver (!!!) • Scoping (within “selector” =>

    sub { ... }) • Embedded Selenium Server (Alien::SeleniumRC) • HtmlUnit Driver 2011೥11݄18೔༵ۚ೔