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
0
170
How to reduce spec runtime by 4400%
How to monkey patch Capybara to avoid session reset
Jimmy Ngu
April 04, 2017
Tweet
Share
More Decks by Jimmy Ngu
See All by Jimmy Ngu
Ruby Runtime
jimmynguyc
0
62
Ruby 2.7preview1
jimmynguyc
0
48
The Original Immortal Game
jimmynguyc
0
33
Introduction to Ruby Hyperloop
jimmynguyc
0
120
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
120
Ruby's JIT
jimmynguyc
2
76
TRICK 2015
jimmynguyc
0
91
Hacking Rails
jimmynguyc
0
67
TRICK
jimmynguyc
0
73
Other Decks in How-to & DIY
See All in How-to & DIY
ミニ四駆ベースのAIカー TatamiRacerの製作
covao
1
290
AWS Summit Japan 2025 個人的参加レポート
midnight480
0
160
#Stampfly #M5Stack 開発ストーリーと今後の可能性 前説
takasumasakazu
0
140
The Definitive? Guide To Locally Organizing RubyKaigi
sylph01
6
1.7k
miiboとamiibo繋げてみた。 #miibo #amiibo #iotlt
n0bisuke2
1
390
わたしと仕事とアジャイルコミュニティ / developers summit 2025
matsuoshi
0
1.2k
Raspberry Pi Connectを使って #Manus => Node-RED操作チャレンジ #iotlt vol121
n0bisuke2
0
150
JAWS-UG と AWS - JAWS-UG 沖縄 Cloud on the Beach 2025
awsjcpm
0
100
わたしと技術コミュニティとキャリア
kotomin_m
2
1.8k
AWSコミュニティプログラムとJAWS-UGアップデート / JAWS-UG函館 勉強会 vol.14
awsjcpm
2
150
CH32Vシリーズを楽しもう(74thの場合) / enjoy ch32v series
74th
1
1.1k
How to get hundreds of organic backlinks through statistics link building
ronishehu
1
300
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
KATA
mclloyd
32
15k
Why Our Code Smells
bkeepers
PRO
339
57k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Rails Girls Zürich Keynote
gr2m
95
14k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.5k
Agile that works and the tools we love
rasmusluckow
331
21k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Bash Introduction
62gerente
615
210k
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