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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
36
Introduction to Ruby Hyperloop
jimmynguyc
0
120
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
120
Ruby's JIT
jimmynguyc
2
78
TRICK 2015
jimmynguyc
0
93
Hacking Rails
jimmynguyc
0
73
TRICK
jimmynguyc
0
74
Other Decks in How-to & DIY
See All in How-to & DIY
JAWS-UG/AWSコミュニティプログラムのご紹介 - JAWS-UG 佐賀
awsjcpm
2
200
Burnoutとの「対話」 〜 アジャイルコーチングを活用した、燃え尽き症候群を克服するスキル 〜 / Dialogue with Burnout by Using Agile Coaching Skills
hageyahhoo
0
680
How to make the Groovebox
asonas
2
1.9k
SoracomUG-Ishikawa-1.pdf
yukima77
0
140
파이썬 토룡신점 운영후기
lqez
0
510
ネガティブをねじ伏せ、n=1のキャリアに変える技術
subroh0508
1
1.1k
2025年03月02日 メイカーズながおかまつり での講演 「コミュニティベースでの製品開発ものづくりフェアの役割」
takasumasakazu
0
310
HCIのデモに役立つ映像活用アイデア集 #WISS2024 ナイトセッション #HCIVideoCulture
bonsaistudiojp
2
1.1k
MustをWillに変える技術 〜アイドル・郁田はるきが"すべき"の壁を超えるまで〜
subroh0508
1
1.6k
放っておくと怖い睡眠負債について/fjordbootcamp-251122
yuukago
3
170
Xの"だるま"とコナミコマンド #iotlt #obniz
n0bisuke2
0
300
Node-REDで制御できるエッジカメラのreCameraを触る #iotlt #JLCPCB #recamera
n0bisuke2
0
150
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
How to Ace a Technical Interview
jacobian
281
24k
Building an army of robots
kneath
306
46k
Chasing Engaging Ingredients in Design
codingconduct
0
110
Embracing the Ebb and Flow
colly
88
5k
The Spectacular Lies of Maps
axbom
PRO
1
530
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Prompt Engineering for Job Search
mfonobong
0
160
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
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