Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
0
180
How to reduce spec runtime by 4400%
How to monkey patch Capybara to avoid session reset
Jimmy Ngu
April 04, 2017
Tweet
Share
More Decks by Jimmy Ngu
See All by Jimmy Ngu
Ruby Runtime
jimmynguyc
0
65
Ruby 2.7preview1
jimmynguyc
0
49
The Original Immortal Game
jimmynguyc
0
34
Introduction to Ruby Hyperloop
jimmynguyc
0
120
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
120
Ruby's JIT
jimmynguyc
2
77
TRICK 2015
jimmynguyc
0
93
Hacking Rails
jimmynguyc
0
71
TRICK
jimmynguyc
0
74
Other Decks in How-to & DIY
See All in How-to & DIY
Azure PortalのQoLを上げてたら Big Techに怒られた
horihiro
2
490
Node-REDで制御できるエッジカメラのreCameraを触る #iotlt #JLCPCB #recamera
n0bisuke2
0
130
ModuleLLM、最前線!
anoken
1
280
テストも、国際化も! 小中高生クリエータ支援プログラム『未踏ジュニア』を支える技術
yasulab
1
250
評価のギャップから紐解く、「評価軸」と「ソフトスキル」の重要性
blajir
2
120
家具家電付アパートの自室の冷蔵庫をスマートIoT化してみた!
scbc1167
0
150
AIをフル活用! 猫版MBTI「CATS診断」 爆速開発の裏側【個人開発のAIツール活用 LT Night 登壇用スライド】
omori0219
0
1.3k
JAWS-UGのご紹介 JAWS-UGとは?
awsjcpm
0
5.5k
なぜJAWS-UGはこんなにも活発なのか?
awsjcpm
1
160
あなたは何故コミュニティに参加するのか?
awsjcpm
2
240
AWSと学生支援 - Education-JAWS #0
awsjcpm
1
200
Node-REDでセンサーなどから起動させるカメラノードを作ったよ IoTLT vol123 #iotlt
n0bisuke2
0
110
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Optimizing for Happiness
mojombo
379
70k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
It's Worth the Effort
3n
187
29k
Become a Pro
speakerdeck
PRO
31
5.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.8k
How GitHub (no longer) Works
holman
316
140k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
A Tale of Four Properties
chriscoyier
162
23k
RailsConf 2023
tenderlove
30
1.3k
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