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
TDDとVimと
Search
Yuta Totz
October 23, 2015
Programming
1
490
TDDとVimと
RailsまわりのTDDと、Vimについて。
Yuta Totz
October 23, 2015
Tweet
Share
More Decks by Yuta Totz
See All by Yuta Totz
ウガンダでXcodeをアップデートする方法
totzyuta
0
110
Working with UNIX Process 6/7 Chapter
totzyuta
1
60
珈琲と僕
totzyuta
0
93
読んで理解するActiveRecordの設計とActiveSupport::Concern
totzyuta
4
1.5k
モテる!筋肉コンパイラ自作入門 - 草食男子からの卒業
totzyuta
0
420
Git/GitHub入門-GitHubでたのしいチーム開発
totzyuta
0
300
Vimmer幼稚園
totzyuta
2
110
たのしいたーみなる
totzyuta
0
40
Other Decks in Programming
See All in Programming
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
3
170
チームの立て直し施策をGoogleの 『効果的なチーム』と見比べてみた
maroon8021
0
200
Terraform で作る Amazon ECS の CI/CD パイプライン
hiyanger
0
110
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
440
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
370
Spring gRPC について / About Spring gRPC
mackey0225
0
130
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
410
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
0
140
SRE、開発、QAが協業して挑んだリリースプロセス改革@SRE Kaigi 2025
nealle
1
3k
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
1
470
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
780
AHC041解説
terryu16
0
520
Featured
See All Featured
RailsConf 2023
tenderlove
29
980
Into the Great Unknown - MozCon
thekraken
34
1.6k
Docker and Python
trallard
43
3.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
GitHub's CSS Performance
jonrohan
1030
460k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
6
210
Transcript
TDD ͱ Vim ͱ Red-Green-Refactoring Cycle with Vim
Resume • Introduction • What is “test”? • TDD on
Red-Green-Refactor Cycle • TDD by Vim • Demo • Conclusion • Links and Books
ࣗݾհ
ͱͭ ށ௩ ༎ଠ (@totzyuta) OneBox Inc. ίʔώʔ ݉ WebΤϯδχΞ
ςετɺॻ͍ͯ·͔͢ʁ
What is “test”?
What is test? • ΞϓϦέʔγϣϯ͕ਖ਼͘͠ಈ͘͜ͱΛอূ͢ ΔͨΊͷΞϓϦέʔγϣϯͰͳ͍ίʔυ • ୯ମςετɺػೳςετɺ૯߹ςετ • (ݺͼํͷఆ͍ٛ͋·͍)
• UnitςετͱFeatureςετ
Categories of Tests • Unitςετ • ૄ݁߹తͳUnit͝ͱͷ࠴Λอূ͢Δ • associationͷਖ਼͠͞ͷ୲อ •
Featureςετ • Unitؒͷ݁߹ • => ػೳશମͱͯ͠ͷಈ͖ͷਖ਼͠͞Λอূ͢Δ • Model, Controller, ViewΛ۲͠Ͱ͖Δʂ
Testing Frameworks • Minitest • Railsඪ४ (DHHਞ) • ຊͰ࠷ۙͪΐͬͱ͏ਓ૿͖͑ͯͨ •
RSpec • ͳΜ͔Ή͠Ζඪ४Έ͍ͨʹͳͬͯͨ • ൈຊతͳ༷มߋ͕ಘҙ
3 Principles of Writing Tests • ςετ৴པͰ͖ΔͷͰ͋Δ͜ͱ • ςετ؆୯ʹॻ͚Δ͜ͱ •
ςετ؆୯ʹཧղͰ͖Δ͜ͱ ref. Everyday Rails - RSpecʹΑΔRailsςετೖ - Aaron Sumner, Junichi Ito, AKIMOTO Toshiharu, ৼߐ ڕ
TDD on Red-Green- Refactor Cycle
“TDD is dead.” — David Heinemeier Hansson
What is TDD? • ʮϏδωεϓϩάϥϜΛॻ͘લʹɺςετίʔ υΛॻ͘͜ͱʯ • ςετ͕༷ॻʹͳΔ (!!) •
Red-Green-Refactor Cycle
Flow of TDD on Red-Green-Refactor Cycle 1. ςετͰઃܭॻΛॻ͘ (RED) 2.
࠷͔ͭ࠷؆୯ʹςετΛ௨͢ίʔυΛॻ͘ (GREEN) • ͍ͭ͜ςετίʔυͷςετ 3. ϦϑΝΫλϦϯά (Refactor) • ͜Ε͕ຊؾͷ࣮ • “ϦϑΝΫλϦϯά”ͬͯͭͱͪΐͬͱҧ͏ • Red͕ΘΔ͍ɺGreen͕Α͍Ͱͳ͍ʂ ref. cookpad 2015 summer internship TDD by Yoshiori SHOJI
TDD - ϝϦοτᶃ • ςετίʔυΛઌʹॻ͘͜ͱʹΑͬͯɺࣗ ͕࡞Δ͖ϓϩάϥϜ͕໌֬Խ͢Δɻ • ࣄલʹ࡞͢ΔϓϩάϥϜΠϝʔδ͕ੜ·Ε ΔͨΊ༷ᴥᴪʹؾͮ͘ػձ͕ૣΊʹ๚Ε Δɻ
TDD - ϝϦοτᶅ • ςετίʔυ͕ඞͣશͯ࡞͞ΕΔ • Ϟνϕʔγϣϯ • ෆ҆Λ๊͑ͨ··ͷ։ൃ͞Α͏ͳΒ
Vim
VimͰRailsͳϓϥάΠϯ • jodosha/vim-greenbar • jodosha/vim-devnotes • dbext.vim • tpope/rails.vim •
The-NERD-tree
VimͰRailsͳϓϥάΠϯ • bronson/vim-trailing-whitespace • tpope/vim-endwise • vim-scripts/AnsiEsc.vim
ුؾ૬ख
Demo
Demo $ rails new coedotask $ rails g scaffold Task
name:string time:integer • λεΫཧΞϓϦέʔγϣϯ - coedotask • ͜Εʹ Task.calc_total_time ΛՃ͠·͢ʂ
Flow of TDD on Red-Green-Refactor Cycle 1. ςετͰઃܭॻΛॻ͘ (RED) 2.
࠷͔ͭ࠷؆୯ʹςετΛ௨͢ίʔυΛॻ͘ (GREEN) • ͍ͭ͜ςετίʔυͷςετ 3. ϦϑΝΫλϦϯά (Refactor) • ͜Ε͕ຊؾͷ࣮ • “ϦϑΝΫλϦϯά”ͬͯͭͱͪΐͬͱҧ͏ • Red͕ΘΔ͍ɺGreen͕Α͍Ͱͳ͍ʂ ref. cookpad 2015 summer internship TDD by Yoshiori SHOJI
Conclusion • TDD։ൃऀΛͤʹͯ͘͠ΕΔ (?) • “TDD is dead” ͔͔Βͳ͍͚ͲͻͱΓͻͱ Γͷ࣮ફ͕Web։ൃʹ͓͚ΔςεςΟϯάͷ
ະདྷΛܾΊ͍ͯ͘ • ʹͳͬͯͨͷ͍͠
͋Δͷ͜ͱ
None
*ŋʄƅŋ*:.Ň..Ň.:*ŋ'( ƅ˜ƅ*)'ŋ*:.Ň. .Ň.:*ŋʄƅŋ*
None
*ŋʄƅŋ*:.Ň..Ň.:*ŋ'( ƅ˜ƅ*)'ŋ*:.Ň. .Ň.:*ŋʄƅŋ*
ॻ੶ • Everyday Rails Testing with RSpecTDD • Aaron Sumner
ࢀߟ • BDDʹ͍ͭͯࣗͳΓʹ·ͱΊͯΈͨ • TDD is dead. Long live testing.
• Effective TDD With Ruby: Time & Flow
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ