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
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to reduce spec runtime by 4400%
How to monkey patch Capybara to avoid session reset
Jimmy Ngu
April 04, 2017
More Decks by Jimmy Ngu
See All by Jimmy Ngu
Ruby Runtime
jimmynguyc
0
79
Ruby 2.7preview1
jimmynguyc
0
58
The Original Immortal Game
jimmynguyc
0
56
Introduction to Ruby Hyperloop
jimmynguyc
0
130
Introduction to Machine Learning with Tensorflow.rb
jimmynguyc
0
130
Ruby's JIT
jimmynguyc
2
84
TRICK 2015
jimmynguyc
0
98
Hacking Rails
jimmynguyc
0
79
TRICK
jimmynguyc
0
83
Other Decks in How-to & DIY
See All in How-to & DIY
大学内にファブスペースをつくってみた #sapporo3dp / Making HIU Fab
yumulab
1
210
「変えること」「変わること」を楽しむ力で"敵わない存在"と向き合う
subroh0508
2
3.4k
Linuxが動く自作SBCを作る話.pdf
daimiya
1
880
餃子コミュニティの活性化/TechGYOZA
nishiuma
2
400
生成AIは 『コードを書く』だけじゃない アーキテクチャ設計から環境構築まで——社内データ活用DXの全貌
punipuni_mint
0
230
あなたは何故コミュニティに参加するのか?
awsjcpm
3
440
Azure PortalのQoLを上げてたら Big Techに怒られた
horihiro
2
630
251011「ひとりより、みんなで!」 九州の支部で始めた、新しい連携のかたち
east_takumi
2
180
OSSコミュニティがくれた「人との繋がり」
tanahiro2010
2
440
AIツール“三種の神器”ではじめる 自動運転AIチャレンジ
covao
0
120
社会人9年目の僕が贈る処世術
coco_se
1
330
JAWS-UG/AWSコミュニティ JAWS-UG おおいた
awsjcpm
2
3.1k
Featured
See All Featured
Ethics towards AI in product and experience design
skipperchong
2
360
Crafting Experiences
bethany
1
290
Un-Boring Meetings
codingconduct
0
410
How to train your dragon (web standard)
notwaldorf
97
6.8k
The Limits of Empathy - UXLibs8
cassininazir
1
640
Exploring anti-patterns in Rails
aemeredith
3
490
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.7k
Test your architecture with Archunit
thirion
2
2.4k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
920
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
320
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
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