Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Brownie
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Masaki Nakagawa
November 18, 2011
Programming
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Brownie
Brownie - Browser integration framework inspired by Capybara / Yokohama.pm #8
Masaki Nakagawa
November 18, 2011
More Decks by Masaki Nakagawa
See All by Masaki Nakagawa
yapc-tokyo-2019-over-10years-perl-after-story
ikasam_a
0
460
Perl Testing Consideration
ikasam_a
3
180
Other Decks in Programming
See All in Programming
Simple Storage Service(S3) is not simple
iwatsukayura
0
250
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
180
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
150
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
160
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
110
速習iPhone Duo対応
yuukiw00w
2
980
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
140
Agents on Rails - Rails at Scale 2026
irinanazarova
0
530
すこし踏み込む CancellationToken
htkym
2
1.7k
Workers Cache を知る
syumai
0
350
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
980
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Being A Developer After 40
akosma
92
590k
Designing for Timeless Needs
cassininazir
1
520
KATA
mclloyd
PRO
35
16k
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Test your architecture with Archunit
thirion
2
2.4k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Producing Creativity
orderedlist
PRO
348
41k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
320
Transcript
Brownie Masaki Nakagawa / @ikasam_a Yokohama.pm #8 (yokohama.pm.org/2011/10/yokohamapm-8.html) 201111݄18༵ۚ
YAPC::Asia Tokyo 2011 yapcasia.org/2011/ 201111݄18༵ۚ
Perl Testing Consideration (seen from other languages) Masaki Nakagawa YAPC::Asia
Tokyo 2011 (yapcasia.org/2011/talk/80) 201111݄18༵ۚ
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 201111݄18༵ۚ
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 201111݄18༵ۚ
Comparision • Pros • TAP-based Test Description • Many Helpful
Modules • Cons • Non-Uniform Browser Integration • Poor Expectation and Verification 201111݄18༵ۚ
Capybara github.com/jnicklas/capybara 201111݄18༵ۚ
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. 201111݄18༵ۚ
within("#session") do fill_in 'Login', :with => '
[email protected]
' fill_in 'Password', :with
=> 'password' end click_link 'Sign in' 201111݄18༵ۚ
The DSL 201111݄18༵ۚ
Drivers RackTest Selenium HtmlUnit WebKit (QtWebKit) Envjs Zombie.js 201111݄18༵ۚ
Brownie github.com/masaki/Brownie 201111݄18༵ۚ
Inspired by Capybara 201111݄18༵ۚ
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 201111݄18༵ۚ
DSL Style (Not yet) use Brownie::DSL; visit ‘http://example.com/’; fill_in Login
=> '
[email protected]
'; fill_in Password => 'password'; click_link 'Sign in'; 201111݄18༵ۚ
Drivers Selenium (Selenium::Remote::Driver) Mechanize (WWW::Mechanize) HtmlUnit (WWW::HtmlUnit) 201111݄18༵ۚ
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, 201111݄18༵ۚ
DEMO 201111݄18༵ۚ
Future • Mechanize Driver (!!!) • Scoping (within “selector” =>
sub { ... }) • Embedded Selenium Server (Alien::SeleniumRC) • HtmlUnit Driver 201111݄18༵ۚ
Patches and Collaborators Welcome !!! 201111݄18༵ۚ
Thank you 201111݄18༵ۚ