Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
テストってなんだろう?
Search
itosho
July 24, 2018
Programming
310
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
テストってなんだろう?
クローズドな勉強会でのLT資料です。
itosho
July 24, 2018
More Decks by itosho
See All by itosho
【2025年版】インターネットサービスの育て方 / How to Grow and Scale Internet Services 2025
itosho
0
290
Windsurf Rulesでどう自分のクローンをつくるか / How can I make a clone of myself in Windsurf Rules
itosho
0
150
Text EditorとしてのWindsurf / Windsurf as a Text Editor
itosho
0
390
【2024年版】インターネットサービスの育て方 / How to Grow and Scale Internet Services
itosho
0
140
打線組という個人サービスを Goで開発している話 / Indie Service Development by Go
itosho
1
210
Components Reconsidered
itosho
1
2.4k
打線組を支える技術 / The Technology Behind Dasengumi
itosho
0
79
組織をスケールさせるためのTech Vision / Connehito Tech Vision for Growing Our Team
itosho
2
720
生きのびるためのインディー開発 / Indie Development to Survive
itosho
0
74
Other Decks in Programming
See All in Programming
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
140
Verilogで学ぶCPU自作入門.pdf
uyuki234
8
4k
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
450
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
Kubernetes祭り #2 OP/ED
bells17
0
100
JRuby: Past, Present, and Future
headius
0
220
wkhtmltopdfの次どうするか問題2026
willnet
2
1.9k
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
770
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.5k
Are APIs Still Relevant in the AI Era?
soyuka
0
430
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Side Projects
sachag
456
43k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
530
The Cult of Friendly URLs
andyhume
79
7k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
We Have a Design System, Now What?
morganepeng
55
8.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Raft: Consensus for Rubyists
vanstee
142
7.7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
How to Talk to Developers About Accessibility
jct
2
560
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Transcript
テストってなんだろう? Connehito Inc. @itosho 1
▪ 自己紹介 ・伊藤 翔 @itosho ・所属:コネヒト株式会社 / リードエンジニア ・会社ではサーバーサイドエンジニアをやっています ・よく書く言語:PHP
/ Ruby / Golang ・家ではYome Driven Developmentをやっています ・つくっているサービス:カレンダー / 家計簿 / セール情報通知
▪ 今日話すこと ・事前にいただいたアンケートに沿って…! ・普段書いているテスト ・テストで苦労していること ・テストのメリット / デメリット ・運用についてのコネヒト社での事例 ・今日話さないこと
・E2Eテスト / 総合テスト ・TDD / BDD
1. テストを実装したことありますか 4
5
2. どのようなテストを実装しましたか 6
▪ 普段書いているテスト / ツール ・Web APIのIntegrationテスト / Unitテスト ・PHPUnit /
RSpec ・CLIツールのUnitテスト ・testingパッケージ(Golang) ・OSSのUnitテスト ・https://github.com/itosho/easy-query ・PHPUnit / codecov
3. テストを実装する際に苦労したことはなんですか 8
▪ 苦労している点 ・テストデータの管理・保守 ・”モノリシック”なFixtureデータ ・あるテストのためにデータを修正すると別のテストが壊れる ⇒FactoryBot(旧: FactoryGirl)を使って動的にデータを作る ・テストのためにミニ言語(DSL)を覚える必要がある ・RSpec /
FactoryBot等 ・高機能なツールであるほど学習コストが高い ⇒Golangでは標準のtestingパッケージのみを使う
▪ 苦労している点 ・外部サービス / コマンドとの連携 ・モックの実装が必要(難しい) ・意味のない壊れやすいスタブ ⇒外部とやりとりを行う境界をinterface(モックポイント)にする ⇒Consumer Driven
Test(あんまり詳しくないですが…) ref: https://deeeet.com/writing/2016/10/25/go-interface-testing/
4. テストを実装して感じたメリットはなんですか 11
▪ メリット ・リファクタ&仕様変更時のスピード&安心感 ・テストが”正しく”壊れる ・暖かみのある回帰テストが不要になる ・テストコードが生きたドキュメントになる ・コードの変更とほぼ自動的に同期される ・テストがあるOSSはダウンロードされやすい ・カバレッジがあるとさらにGood
5. テストを実装して感じたデメリットはなんですか 13
▪ デメリット ・慣れるまで(慣れても?)開発スピードが落ちる ・TDDはこの限りではない(設計技法なので) ・プロダクトが成長するとCIの実行時間が長くなりがち ・特にiOS / Androidのテスト ・教条主義的になりやすい(特にUnitテスト) ・Unitテストを書くとコードの品質が上がる
・Unitテストを書くと設計が綺麗になる ⇒正しいけど正しくない
6. 運用はうまく回っていますか 15
▪ コネヒト社でのCI/CD事例 ・Web APIに関しては原則テストコードを書く ・画面がないのでテストが書きやすい ・PHPUnitを利用 ・CIはTravis CIを利用 ・CI時に静的解析 /
Lintツールを実行 ・使用ツール ・Phan / PHP CodeSniffer ・reviewdog / Danger ⇒機械が出来ることは機械に任せる
まとめ 17
▪ テストとは… ・テストはお金を生まない ・Yome Drive Developmentにおいてテストを書く意味はない ・バグ出したらさっさと直すかケーキでも買ってきたほうがよい ・テストは保険 ・不具合による機会損失と運用コストを予め防ぐ ・自動化することでコスト圧縮が積分で効いてくる
ref: http://shyouhei.tumblr.com/post/73195212853/テストのめどい話 ⇒テストで自分たちの身を守っていこう!
宣伝 19
▪ コネヒトでも勉強会開催します! ・Connehito Marché #3〜iOS市〜 ・8/7(火)19:00〜21:30 ・LT枠 / オーディエンス枠ともに絶賛募集中! ・connpass:
https://connehito.connpass.com/event/95285/ ・Twitter: https://twitter.com/connehitomarche
ご清聴ありがとうございました 21