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
ATOMS3R-CAMとClaude SKILLSでタイムラプスチャレンジ #iotlt
n0bisuke2
0
390
2025版 鯖落ちパーツで安価に機械学習用マシンを作ってみる
bobfromjapan
0
950
JAWS-UG 山梨 第10回 勉強会 Community Update
awsjcpm
0
1.1k
Node-REDでセンサーなどから起動させるカメラノードを作ったよ IoTLT vol123 #iotlt
n0bisuke2
0
170
JAWS-UG/AWSコミュニティ アップデート (JAWS-UG函館支部)
awsjcpm
3
170
多摩ニュータウンを、 味わう
aokiplayer
2
730
Rails 8.1.1 × Claude Code
miyakawa2449
1
100
EXPO 2025 大屋根リングをぐるっと周回! 【GPSマルチユニット×ソラカメ実験】
scbc1167
0
140
サイボウズには100名以上の社員が出演する"夏フェス"があるって本当?
oguemon
1
920
チームパフォーマンスを高めるための2種類のセルフマネジメント / Two Types of Self-Management for Improving Team Performance
iwashi86
4
860
Linuxが動く自作SBCを作る話.pdf
daimiya
0
780
How to make the Groovebox
asonas
2
2.3k
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
460
4 Signs Your Business is Dying
shpigford
187
22k
Between Models and Reality
mayunak
4
380
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
650
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
650
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
From π to Pie charts
rasagy
0
250
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
170
Build your cross-platform service in a week with App Engine
jlugia
234
19k
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