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
1
120
Brownie
Brownie - Browser integration framework inspired by Capybara / Yokohama.pm #8
Masaki Nakagawa
November 18, 2011
Tweet
Share
More Decks by Masaki Nakagawa
See All by Masaki Nakagawa
yapc-tokyo-2019-over-10years-perl-after-story
ikasam_a
0
350
Perl Testing Consideration
ikasam_a
3
150
Other Decks in Programming
See All in Programming
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
270
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
190
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
420
VisionProで部屋の明るさを反映させるシェーダーを作った話
segur
0
100
テストコード書いてみませんか?
onopon
2
320
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
150
return文におけるstd::moveについて
onihusube
1
1.4k
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
270
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
360
盆栽転じて家具となる / Bonsai and Furnitures
aereal
0
1.7k
functionalなアプローチで動的要素を排除する
ryopeko
1
190
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
Unsuck your backbone
ammeep
669
57k
It's Worth the Effort
3n
183
28k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
The Pragmatic Product Professional
lauravandoore
32
6.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
860
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
Agile that works and the tools we love
rasmusluckow
328
21k
Typedesign – Prime Four
hannesfritz
40
2.5k
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༵ۚ