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
How to reduce spec runtime by 4400%
Search
Jimmy Ngu
April 04, 2017
How-to & DIY
190
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
Transcript
33 slides
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
More Decks by Jimmy Ngu
See All by Jimmy Ngu
Ruby Runtime
jimmynguyc
0
83
Ruby 2.7preview1
jimmynguyc
0
61
The Original Immortal Game
jimmynguyc
0
63
Introduction to Ruby Hyperloop
jimmynguyc
0
140
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
140
Ruby's JIT
jimmynguyc
2
88
TRICK 2015
jimmynguyc
0
100
Hacking Rails
jimmynguyc
0
84
TRICK
jimmynguyc
0
87
Other Decks in How-to & DIY
See All in How-to & DIY
[JAWS DAYS 2026 | Track B] Local Roots, Global Reach
awsjcpm
0
190
4,8 sur 154 avis ou 5,0 sur 6 avis : quel institut de beauté choisir ?
radinscoquets
0
210
不安を「改善のためのシグナル」と捉える-「感情」をセンサーで検知して、少しずつ前に進む方法 - / phpcon_ehime2026
blue_goheimochi
1
190
未熟な発表が歓迎される時代をもう一度
neotag
0
130
JAWS-UG/AWS Community Update 2026年6月20日JAWS-UG FUKUOKA #26 JAWS DAYS 2026 re:Cap! おつかれせいけしろー
awsjcpm
0
210
How to Stylus 20251031
hareyakayuruyaka
0
210
JAWS/AWS Community Updates in JAWS-UG富山 at 富山高専
awsjcpm
0
150
NJ-WS10Aを使ったおいしい使い方
masafumi_ohta
0
140
人見知りな HUB おじさんが 会話のハードルを超え、 今度は誰かの踏み台になろうとする話/hub-guy-as-a-stepping-stone
aokiplayer
2
1.7k
LT#9 非線形な物理現象に基づく真性乱数生成器の構築と、暗号学的エントロピー密度の定量的評価について
sakopon
0
170
家庭植物工場×Node-REDの話
maepu
0
170
JAWS-UG横浜100回記念 私のAWS ジャーニーと日本からみた横浜支部
awsjcpm
0
540
Featured
See All Featured
Building the Perfect Custom Keyboard
takai
2
970
Accessibility Awareness
sabderemane
1
310
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
HDC tutorial
michielstock
2
1k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
440
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
3
170
Optimizing for Happiness
mojombo
378
72k
Building Applications with DynamoDB
mza
96
7.3k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
500