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
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
50
The Original Immortal Game
jimmynguyc
0
36
Introduction to Ruby Hyperloop
jimmynguyc
0
120
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
120
Ruby's JIT
jimmynguyc
2
79
TRICK 2015
jimmynguyc
0
94
Hacking Rails
jimmynguyc
0
74
TRICK
jimmynguyc
0
74
Other Decks in How-to & DIY
See All in How-to & DIY
自分がご機嫌になれる 素敵な場所を守るために
kenichirokimura
3
720
活動振り返りと生成AIによるコード生成の試み
covao
0
150
JAWS-UGとAWS - JAWS-UG彩の国埼玉設立のお祝い
awsjcpm
2
640
カンファレンスでリフレッシュ!無理なく楽しむカンファレンス参加術 / How to enjoy conferences without stress
kattsuuya
1
9.6k
파이썬 토룡신점 운영후기
lqez
0
520
JAWS-UG/AWSコミュニティプログラムのご紹介 - JAWS-UG 佐賀
awsjcpm
2
220
LLMはTRPGのGMができる(確信)
kgmkm
0
2.4k
人を補助するAI ~AIとの壁打ちがきっかけになる~ #共創AIミートアップ
ishikiemo
2
550
JAWS-UG/AWSコミュニティ -JAWS-UGくまもと#16
awsjcpm
1
200
ドローンをAWSで制御してみた
nagi900
0
110
Burnoutとの「対話」 〜 アジャイルコーチングを活用した、燃え尽き症候群を克服するスキル 〜 / Dialogue with Burnout by Using Agile Coaching Skills
hageyahhoo
0
750
個人制作コンテンツの多言語展開のノウハウを全公開! 〜世界に自分を発信しよう!〜
syotasasaki593876
0
150
Featured
See All Featured
Docker and Python
trallard
47
3.8k
KATA
mclloyd
PRO
35
15k
4 Signs Your Business is Dying
shpigford
187
22k
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Designing for Timeless Needs
cassininazir
0
160
First, design no harm
axbom
PRO
2
1.1k
Believing is Seeing
oripsolob
1
79
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
190
The Pragmatic Product Professional
lauravandoore
37
7.2k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
140
Building an army of robots
kneath
306
46k
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