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
62
Ruby 2.7preview1
jimmynguyc
0
48
The Original Immortal Game
jimmynguyc
0
33
Introduction to Ruby Hyperloop
jimmynguyc
0
120
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
120
Ruby's JIT
jimmynguyc
2
76
TRICK 2015
jimmynguyc
0
91
Hacking Rails
jimmynguyc
0
67
TRICK
jimmynguyc
0
73
Other Decks in How-to & DIY
See All in How-to & DIY
How to create better speaker proposals
logico_jp
2
990
Within the team, I grow as a tester and continuously pursue product quality
camel_404
6
2.7k
あなたは何故コミュニティに参加するのか?
awsjcpm
1
200
バッドプラクティスから学ぶハワイアン航空で行く re:Invent
kentosuzuki
0
380
わたしと仕事とアジャイルコミュニティ / developers summit 2025
matsuoshi
0
1.2k
バーチャルバナナとリアルバナナ #iotlt #TouchDesigner
n0bisuke2
0
180
BlueTeamer勉強会 Security Onion編 激闘!Importノード
disconinja
1
410
ブロックテーマをゴリゴリに使い倒してサイトを作った話 / Kansai WordPress Meetup 2025 01 25
tbshiki
1
670
How to make the Groovebox
asonas
2
1.7k
파이썬 토룡신점 운영후기
lqez
0
480
SoracomUG-Ishikawa-1.pdf
yukima77
0
100
ORBBEC会社概要 製品カタログ 2024 11 10
takasumasakazu
0
160
Featured
See All Featured
Code Review Best Practice
trishagee
72
19k
Docker and Python
trallard
46
3.6k
How GitHub (no longer) Works
holman
315
140k
Fireside Chat
paigeccino
40
3.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
960
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.2k
Statistics for Hackers
jakevdp
799
220k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
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