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
苦いビールを避ける冴えたやり方
watany
2
430
【加筆修正版】ハードワークを支えるフィジカルとメンタルを構築る#rubymusclemixin 活動 #きのこ2025 #きのこ2025_b
bash0c7
0
250
【ふりかえりワークショップ】Tryを決めるだけじゃない!感情にフォーカスした、ふりかえりを体験しよう!
scrummasudar
0
500
AIをフル活用! 猫版MBTI「CATS診断」 爆速開発の裏側【個人開発のAIツール活用 LT Night 登壇用スライド】
omori0219
0
1.1k
JAWS-UG/AWSコミュニティ -JAWS-UGくまもと#16
awsjcpm
1
140
QFHアンテナを作ってみた、 それとパッチアンテナ
takurx
1
190
すぐできる! 運送業でやってみた業務効率化3選
dochin2635
0
110
ミニ四駆ベースのAIカー TatamiRacerの製作
covao
1
270
ジャンカーよ、車も買え ~10分でわかる!? 中古車選び入門~
arkw
1
140
家具家電付アパートの自室の冷蔵庫をスマートIoT化してみた!
scbc1167
0
120
How to make the Groovebox
asonas
2
1.6k
未来大生の胃を支える函館グルメ
deflis
0
530
Featured
See All Featured
Navigating Team Friction
lara
189
15k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Unsuck your backbone
ammeep
671
58k
A designer walks into a library…
pauljervisheath
207
24k
Facilitating Awesome Meetings
lara
55
6.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
It's Worth the Effort
3n
187
28k
Practical Orchestrator
shlominoach
190
11k
Gamification - CAS2011
davidbonilla
81
5.4k
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