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
70
Other Decks in How-to & DIY
See All in How-to & DIY
苦手の克服方法 / How to overcome weaknesses
toma_sm
0
280
PlatformIO IDE用M5Stack定型コード環境の紹介
3110
1
560
miiboとamiibo繋げてみた。 #miibo #amiibo #iotlt
n0bisuke2
1
370
LT(Lightning Talk)のドキドキ感を共有する IoT ぼっとを作った話
scbc1167
1
220
安全に失敗するための手遊び-未定義動作を引き出そう-
zilmina
0
640
Terra Charge|急速充電器ご利用ガイドブック / Terra Charge Fast Charger Guidebook
contents
1
390
HCIのデモに役立つ映像活用アイデア集 #WISS2024 ナイトセッション #HCIVideoCulture
bonsaistudiojp
2
940
エンジニアになって2年間で学んだこと
kaiphoenix
0
190
LLMはTRPGのGMができる(確信)
kgmkm
0
1.2k
How to get hundreds of organic backlinks through statistics link building
ronishehu
1
280
AWS Community Day 2024: Using AWS to build a launchable knowledge rocket 👉 Organize knowledge, accelerate learning and understand AI in the process
dwchiang
0
220
Why did my proposals get rejected?
okuramasafumi
1
700
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
800
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Gamification - CAS2011
davidbonilla
81
5.4k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Navigating Team Friction
lara
188
15k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Facilitating Awesome Meetings
lara
54
6.5k
Mobile First: as difficult as doing things right
swwweet
223
9.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
The Language of Interfaces
destraynor
158
25k
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