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
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
ブロックテーマをゴリゴリに使い倒してサイトを作った話 / Kansai WordPress Meetup 2025 01 25
tbshiki
1
1.6k
プログラミング道場 "CoderDojo" を支援するサーバー提供システム 『DojoPaaS』 / How DojoPaaS powers the CoderDojo community in Japan
coderdojojapan
PRO
0
150
JAWS-UG初心者支部 JAWS-UG Updates
awsjcpm
4
110
How to Create a Betpro Account in Pakistan [Complete Guide]
betproid
0
340
猟銃所持許可を取ってみた
kenkino
2
140
EjecTea 2026 / 20260228-osc26tk-ejectea
akkiesoft
0
510
アイデアをカタチにする、イマジニア
haruka_imgr
0
190
AIをフル活用! 猫版MBTI「CATS診断」 爆速開発の裏側【個人開発のAIツール活用 LT Night 登壇用スライド】
omori0219
0
1.4k
JAWS-UG/AWSコミュニティ -JAWS-UGくまもと#16
awsjcpm
1
200
登壇資料を素早く作るための順番
kotomin_m
7
1.7k
EmbeddingGemmaをDifyから使いたいけどAPI経由はつまらん #iotlt #gemma #dify
n0bisuke2
0
160
地方カンファレンスのスタッフしてて思うこと
yumechi
0
190
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
920
Building an army of robots
kneath
306
46k
Thoughts on Productivity
jonyablonski
75
5.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Embracing the Ebb and Flow
colly
88
5k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Documentation Writing (for coders)
carmenintech
77
5.3k
Google's AI Overviews - The New Search
badams
0
930
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
200
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
4 Signs Your Business is Dying
shpigford
187
22k
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