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
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
LLMはTRPGのGMができる(確信)
kgmkm
0
2.6k
Nutanix Community Edition 超入門 25.04
ricefield66
0
250
エッジで動くNode-REDを作る実験 #noderedjp #noderedcon
n0bisuke2
0
500
人を補助するAI ~AIとの壁打ちがきっかけになる~ #共創AIミートアップ
ishikiemo
2
560
JAWS-UG/AWSコミュニティ -JAWS-UGくまもと#16
awsjcpm
1
200
プログラミング道場 "CoderDojo" を支援するサーバー提供システム 『DojoPaaS』 / How DojoPaaS powers the CoderDojo community in Japan
coderdojojapan
PRO
0
160
Linuxが動く自作SBCを作る話.pdf
daimiya
0
470
おっきなガジェットの回線事情
2bo
1
200
JAWS-UG/AWSコミュニティプログラムのご紹介 (JAWS-UG広島)
awsjcpm
1
130
JAWS-UG/AWS Communities Updates 2025/11/8 JAWS-UG 島根支部
awsjcpm
1
150
移動は善 / 20260124-NGK2026S
girigiribauer
1
130
JAWS-UG Community Upadate - JAWS-UG 熊本
awsjcpm
2
230
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Music & Morning Musume
bryan
47
7.1k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
97
Facilitating Awesome Meetings
lara
57
6.8k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
54k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
210
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Test your architecture with Archunit
thirion
1
2.2k
30 Presentation Tips
portentint
PRO
1
270
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