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
私の ダイエット トレーナー AIさんから 自己紹介が あります
itsukiisamu
0
120
JAWS-UG/AWS Community Update - 2026/6/13 JAWS-UG TOHOKU 仙台
awsjcpm
0
760
エッジAIでBBQの肉の焼き加減判定をやってみた #iotlt #seeed
n0bisuke2
2
290
JAWS-UG初心者支部 JAWS-UG Updates
awsjcpm
4
130
LLMを「機能」として組み込む技術:「Figma to はてなCMS」におけるプロンプトエンジニアリングからAIエージェント構築にわたる精度向上の軌跡
nanimonodemonai
0
520
私がカンファレンスのプロポーザルを書くときに考えていること
kotomin_m
1
750
『いってらっしゃい』と『お帰りなさい』を言ってくれる『ぬい』 に動きをつけてみた!
scbc1167
0
120
JAWS-UGとAWS - JAWS-UG彩の国埼玉設立のお祝い
awsjcpm
2
710
Linuxが動く自作SBCを作る話.pdf
daimiya
0
670
大学内にファブスペースをつくってみた #sapporo3dp / Making HIU Fab
yumulab
1
170
なぜISPでオリジナルカードゲームを作ったのか?制作者と対談 - NIFTY Tech Talk #25
niftycorp
PRO
0
100
令和なのでVoIP網に参加して電話サービスを作ってみた話
cibmc
0
140
Featured
See All Featured
Building the Perfect Custom Keyboard
takai
2
800
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
720
Testing 201, or: Great Expectations
jmmastey
46
8.2k
How to make the Groovebox
asonas
2
2.2k
Practical Orchestrator
shlominoach
191
11k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Navigating Team Friction
lara
192
16k
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