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
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
個人制作コンテンツの多言語展開のノウハウを全公開! 〜世界に自分を発信しよう!〜
syotasasaki593876
0
140
わたしと仕事とアジャイルコミュニティ / developers summit 2025
matsuoshi
0
1.7k
Maker Mela Mumbai 2025 資料 2024/12/12取得
takasumasakazu
0
120
活動振り返りと生成AIによるコード生成の試み
covao
0
140
ネガティブをねじ伏せ、n=1のキャリアに変える技術
subroh0508
1
1.1k
人はなぜコミュニティとつながると幸せを感じるのか
448jp
3
370
猟銃所持許可を取ってみた
kenkino
2
130
JAWS-UG/AWSコミュニティプログラムのご紹介 (JAWS-UG広島)
awsjcpm
1
110
サイボウズには100名以上の社員が出演する"夏フェス"があるって本当?
oguemon
0
560
EmbeddingGemmaをDifyから使いたいけどAPI経由はつまらん #iotlt #gemma #dify
n0bisuke2
0
140
JAWS-UG Community Upadate - JAWS-UG 熊本
awsjcpm
2
210
テストも、国際化も! 小中高生クリエータ支援プログラム『未踏ジュニア』を支える技術
yasulab
PRO
1
290
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
100
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
66
37k
Ruling the World: When Life Gets Gamed
codingconduct
0
150
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
310
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
54
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
GitHub's CSS Performance
jonrohan
1032
470k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.6k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
240
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
380
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