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
79
Ruby 2.7preview1
jimmynguyc
0
56
The Original Immortal Game
jimmynguyc
0
49
Introduction to Ruby Hyperloop
jimmynguyc
0
130
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
130
Ruby's JIT
jimmynguyc
2
84
TRICK 2015
jimmynguyc
0
98
Hacking Rails
jimmynguyc
0
78
TRICK
jimmynguyc
0
82
Other Decks in How-to & DIY
See All in How-to & DIY
おっきなガジェットの回線事情
2bo
1
230
JAWS-UG/AWSコミュニティプログラムのご紹介 (JAWS-UG広島)
awsjcpm
1
160
とある地方技術勉強会に集うエンジニアたちのこれまでとこれから
pharaohkj
1
170
AIツール“三種の神器”ではじめる 自動運転AIチャレンジ
covao
0
110
家を建てて学ぶPjM
rinkei
0
190
OpenClawハンズオンでのトラブルとデバイス向けなんちゃらクロー #IoTLT vol133
n0bisuke2
0
280
JAWS-UG/AWSコミュニティ -JAWS-UGくまもと#16
awsjcpm
1
250
Node-REDでセンサーなどから起動させるカメラノードを作ったよ IoTLT vol123 #iotlt
n0bisuke2
0
170
How to Stylus 20251031
hareyakayuruyaka
0
160
[電子工作]クリップモーターをつくろう
oriontakemura
1
880
地方カンファレンスのスタッフしてて思うこと
yumechi
0
260
私がカンファレンスのプロポーザルを書くときに考えていること
kotomin_m
1
780
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
240
The Mindset for Success: Future Career Progression
greggifford
PRO
0
440
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
290
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Balancing Empowerment & Direction
lara
6
1.2k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
119
120k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
610
GitHub's CSS Performance
jonrohan
1033
470k
First, design no harm
axbom
PRO
2
1.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
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