Top Banner
Brownie Masaki Nakagawa / @ikasam_a Yokohama.pm #8 (yokohama.pm.org/2011/10/yokohamapm-8.html) 20111118日金曜日
21

Brownie

May 22, 2015

Download

Technology

Masaki Nakagawa

Yokohama.pm #8
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Brownie

BrownieMasaki Nakagawa / @ikasam_a

Yokohama.pm #8(yokohama.pm.org/2011/10/yokohamapm-8.html)

2011年11月18日金曜日

Page 2: Brownie

YAPC::Asia Tokyo 2011yapcasia.org/2011/

2011年11月18日金曜日

Page 3: Brownie

Perl Testing Consideration

(seen from other languages)

Masaki Nakagawa

YAPC::Asia Tokyo 2011 (yapcasia.org/2011/talk/80)

2011年11月18日金曜日

Page 4: Brownie

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日金曜日

Page 5: Brownie

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日金曜日

Page 6: Brownie

Comparision

• Pros

• TAP-based Test Description

• Many Helpful Modules

• Cons

• Non-Uniform Browser Integration

• Poor Expectation and Verification

2011年11月18日金曜日

Page 7: Brownie

Capybaragithub.com/jnicklas/capybara

2011年11月18日金曜日

Page 8: Brownie

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日金曜日

Page 9: Brownie

within("#session") do fill_in 'Login', :with => '[email protected]' fill_in 'Password', :with => 'password'endclick_link 'Sign in'

2011年11月18日金曜日

Page 10: Brownie

The DSL

2011年11月18日金曜日

Page 11: Brownie

DriversRackTestSeleniumHtmlUnit

WebKit (QtWebKit)Envjs

Zombie.js

2011年11月18日金曜日

Page 12: Brownie

Browniegithub.com/masaki/Brownie

2011年11月18日金曜日

Page 13: Brownie

Inspired by Capybara

2011年11月18日金曜日

Page 14: Brownie

my $session = Brownie::Session->new;

$session->visit(‘http://example.com’);

$session->fill_in(Login => '[email protected]');$session->fill_in(Password => 'password');$session->click_link('Sign in');

OO Style

2011年11月18日金曜日

Page 15: Brownie

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日金曜日

Page 16: Brownie

DriversSelenium (Selenium::Remote::Driver)

Mechanize (WWW::Mechanize)

HtmlUnit (WWW::HtmlUnit)

2011年11月18日金曜日

Page 17: Brownie

Vocabularyvisit, 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日金曜日

Page 18: Brownie

DEMO

2011年11月18日金曜日

Page 19: Brownie

Future

• Mechanize Driver (!!!)

• Scoping (within “selector” => sub { ... })

• Embedded Selenium Server (Alien::SeleniumRC)

• HtmlUnit Driver

2011年11月18日金曜日

Page 20: Brownie

Patches and Collaborators Welcome !!!

2011年11月18日金曜日

Page 21: Brownie

Thank you

2011年11月18日金曜日