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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Masaki Nakagawa
November 18, 2011
Programming
150
1
Share
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
440
Perl Testing Consideration
ikasam_a
3
170
Other Decks in Programming
See All in Programming
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
120
inferと仲良くなる10分間
ryokatsuse
1
320
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
1
460
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
580
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.4k
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.3k
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
300
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
2
160
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
1.2k
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
150
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.2k
AIエージェントと協働するCLI開発 — BunとOpenClawで学んだこと
yoshikouki
1
230
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
160
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
How to make the Groovebox
asonas
2
2.2k
BBQ
matthewcrist
89
10k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Fireside Chat
paigeccino
42
3.9k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
260
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
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༵ۚ