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
How to reduce spec runtime by 4400%
Search
Jimmy Ngu
April 04, 2017
How-to & DIY
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to reduce spec runtime by 4400%
How to monkey patch Capybara to avoid session reset
Jimmy Ngu
April 04, 2017
More Decks by Jimmy Ngu
See All by Jimmy Ngu
Ruby Runtime
jimmynguyc
0
74
Ruby 2.7preview1
jimmynguyc
0
53
The Original Immortal Game
jimmynguyc
0
47
Introduction to Ruby Hyperloop
jimmynguyc
0
130
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
130
Ruby's JIT
jimmynguyc
2
83
TRICK 2015
jimmynguyc
0
96
Hacking Rails
jimmynguyc
0
78
TRICK
jimmynguyc
0
79
Other Decks in How-to & DIY
See All in How-to & DIY
How to make the Groovebox
asonas
2
2.2k
生成AIは 『コードを書く』だけじゃない アーキテクチャ設計から環境構築まで——社内データ活用DXの全貌
punipuni_mint
0
190
画面の向こうから「気づき」を得る 画面の向こうを「物差し」として捉える
subroh0508
1
330
JAWS-UG/AWS Communities Updates 2025/11/8 JAWS-UG 島根支部
awsjcpm
1
160
AWS Summit Japan 2025 個人的参加レポート
midnight480
0
410
How to Stylus 20251031
hareyakayuruyaka
0
140
人を補助するAI ~AIとの壁打ちがきっかけになる~ #共創AIミートアップ
ishikiemo
2
590
M5StickS3触ってXiaoZhiAI触ってみた #にぼし香 #iotlt
n0bisuke2
0
260
終わりのない会議を超えて:HolacracyのTactical Meetingを体験しよう!
andrearc
0
250
JAWS-UG/AWS Community Update 彩の国埼玉支部1周年記念
awsjcpm
1
110
ボードゲーム × 専用収納 〜3Dプリントで埋めるニッチな隙間〜 / Board Games × Custom Storage
handlename
0
290
「無理」を「コントロール」するスキル / Skills to Control "Muri"
hageyahhoo
6
4.2k
Featured
See All Featured
First, design no harm
axbom
PRO
2
1.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Into the Great Unknown - MozCon
thekraken
41
2.6k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
The Curse of the Amulet
leimatthew05
1
13k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Marketing to machines
jonoalderson
1
5.5k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
Tell your own story through comics
letsgokoyo
1
960
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
240
A Modern Web Designer's Workflow
chriscoyier
698
190k
How to make the Groovebox
asonas
2
2.2k
Transcript
Reducing RSpec Runtime by 4400% by @jimmynguyc
• Engineering Team Lead @ RapidRiver (rrsoft.co) • Specialized in
Rails • Remote First Teams • We’re Hiring!! :D
Outline • What is RSpec • What are Feature Specs
• What are scriptable, headless browsers • Why is it so f**king slow • How I fixed it
RSpec
None
Feature Specs • Feature specs are high-level tests meant to
exercise slices of functionality through an application. They should drive the application only via its external interface, usually web pages.
None
• Pages are rendered • Javascript executed • CSS are
applied • Images are loaded
Headless & Scriptable Browser Engines
Browser Engines KHTML
Popular RSpec HSBE • capybara-webkit • poltergeist with PhantomJS
Why Poltergeist? • Both based on WebKit • Better UI
simulation (e.g. overlapping element prevent clicks) • Can raise JS errors as test errors (js_errors: true) • Easier to install (standalone executable vs qt5 dependencies)
Setup https://github.com/teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist
But …
None
https://github.com/teampoltergeist/poltergeist#memory-leak
None
https://discuss.circleci.com/t/timeout-more-than-120-minutes/640
Why Slow AF? https://circleci.com/docs/1.0/test-metadata/
None
https://github.com/benzittlau/junit-xml-parser DEMO
None
DEBUGGING
https://github.com/LRDesign/rspec-steps
None
https://github.com/teamcapybara/capybara/pull/419
So Let’s DIY
spec/support/capybara.rb
spec/rails_helper.rb
spec/my_spec.rb spec/rails_helper.rb
• change before(:each) to before(:all) • turn let() variables to
instance variables
THANKS