Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Brownie
Search
Masaki Nakagawa
November 18, 2011
Programming
150
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
450
Perl Testing Consideration
ikasam_a
3
170
Other Decks in Programming
See All in Programming
Performance Engineering for Everyone
elenatanasoiu
0
270
Claude Team Plan導入・ガイド
tk3fftk
0
140
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
600
Creating Composable Callables in Contemporary C++
rollbear
0
200
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
160
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
840
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
140
霧の中の代数的エフェクト
funnyycat
1
340
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
220
Contextとはなにか
chiroruxx
1
390
1B+ /day規模のログを管理する技術
broadleaf
0
130
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
280
Featured
See All Featured
Everyday Curiosity
cassininazir
0
250
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
370
4 Signs Your Business is Dying
shpigford
187
22k
Navigating Weather and Climate Data
rabernat
0
310
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
180
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.6k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
650
ラッコキーワード サービス紹介資料
rakko
1
3.9M
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
230
Done Done
chrislema
186
16k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
190
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༵ۚ