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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Jimmy Ngu
April 04, 2017
How-to & DIY
180
0
Share
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
67
Ruby 2.7preview1
jimmynguyc
0
51
The Original Immortal Game
jimmynguyc
0
37
Introduction to Ruby Hyperloop
jimmynguyc
0
120
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
130
Ruby's JIT
jimmynguyc
2
80
TRICK 2015
jimmynguyc
0
94
Hacking Rails
jimmynguyc
0
75
TRICK
jimmynguyc
0
76
Other Decks in How-to & DIY
See All in How-to & DIY
What's the difference in taste between expensive and cheap mills? Measuring coffee particle size distribution using ImageJ
dogrunjp
0
820
MustをWillに変える技術 〜アイドル・郁田はるきが"すべき"の壁を超えるまで〜
subroh0508
1
1.7k
Node-REDで制御できるエッジカメラのreCameraを触る #iotlt #JLCPCB #recamera
n0bisuke2
0
170
私がカンファレンスのプロポーザルを書くときに考えていること
kotomin_m
1
700
JAWS-UG 福岡 in 北九州 | JAWS-UG/AWSコミュニティ プログラムのご紹介
awsjcpm
1
200
EXPO 2025 大屋根リングをぐるっと周回! 【GPSマルチユニット×ソラカメ実験】
scbc1167
0
110
2026年、書籍をちゃんと読むぞ👊 〜約3万円分の書籍を積読にしないためにやること〜
subroh0508
5
840
ライブ感を生む 巻き込み型スライドの作り方/Create your slide like a heavy metal concert
ikuodanaka
5
1.5k
JAWS-UG と AWS - JAWS-UG 沖縄 Cloud on the Beach 2025
awsjcpm
0
140
파이썬 토룡신점 운영후기
lqez
0
540
JAWS-UG/AWSコミュニティプログラムのご紹介 - JAWS-UG 佐賀
awsjcpm
2
240
スイングやカードをいい感じに立てるスタンドの話
niccolli
1
440
Featured
See All Featured
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
GitHub's CSS Performance
jonrohan
1032
470k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
330
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Typedesign – Prime Four
hannesfritz
42
3k
Skip the Path - Find Your Career Trail
mkilby
1
100
For a Future-Friendly Web
brad_frost
183
10k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
460
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
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