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
170
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
61
Ruby 2.7preview1
jimmynguyc
0
47
The Original Immortal Game
jimmynguyc
0
32
Introduction to Ruby Hyperloop
jimmynguyc
0
120
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
120
Ruby's JIT
jimmynguyc
2
75
TRICK 2015
jimmynguyc
0
90
Hacking Rails
jimmynguyc
0
66
TRICK
jimmynguyc
0
72
Other Decks in How-to & DIY
See All in How-to & DIY
エンジニアになって2年間で学んだこと
kaiphoenix
0
190
JAWS-UGから学んだコミュニティの成功要因 (Success Factors)
awsjcpm
5
520
DroidKaigi 2024 - 海外就職というキャリアの選択肢
iyotetsuya
1
1.1k
ブロックテーマをゴリゴリに使い倒してサイトを作った話 / Kansai WordPress Meetup 2025 01 25
tbshiki
1
630
AWS re:Invent 2024 re:Cap – AWS Community Perspective / JAWS-UG新潟
awsjcpm
0
170
評価のギャップから紐解く、「評価軸」と「ソフトスキル」の重要性
blajir
2
100
[電子工作]クリップモーターをつくろう
oriontakemura
0
270
miiboとamiibo繋げてみた。 #miibo #amiibo #iotlt
n0bisuke2
1
380
ModuleLLM、最前線!
anoken
0
250
安全に失敗するための手遊び-未定義動作を引き出そう-
zilmina
0
650
AIをフル活用! 猫版MBTI「CATS診断」 爆速開発の裏側【個人開発のAIツール活用 LT Night 登壇用スライド】
omori0219
0
1.1k
M5Stackを使ってSズキの魔改造モンスターマシンを作ってみた
syumme01
0
210
Featured
See All Featured
Producing Creativity
orderedlist
PRO
347
40k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
We Have a Design System, Now What?
morganepeng
53
7.8k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building Adaptive Systems
keathley
43
2.7k
Building Applications with DynamoDB
mza
96
6.6k
Designing Experiences People Love
moore
142
24k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
Agile that works and the tools we love
rasmusluckow
330
21k
Code Reviewing Like a Champion
maltzj
525
40k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
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