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
モックフレームワーク比較 / Mocking Framework Comparison
Search
Jierong Li
August 20, 2020
Programming
0
490
モックフレームワーク比較 / Mocking Framework Comparison
Jierong Li
August 20, 2020
Tweet
Share
More Decks by Jierong Li
See All by Jierong Li
一般的な通信でも使える バックグラウンドURLSessionの活用方法 / How to use background URLSession for general network data transfer tasks.
myihsan
0
2k
Multi-Module 101
myihsan
0
320
Hierarchical Structure について / About Hierarchical Structure
myihsan
1
490
What’s New in Accessibility WWDC21
myihsan
1
280
Property WrapperでDecodableのデフォルト値を設定 / Providing Default Value for Decodable Property by Property Wrapper
myihsan
1
280
Other Decks in Programming
See All in Programming
読まないコードリーディング術
hisaju
0
110
苦しいTiDBへの移行を乗り越えて快適な運用を目指す
leveragestech
0
1.1k
Serverless Rust: Your Low-Risk Entry Point to Rust in Production (and the benefits are huge)
lmammino
1
160
Django NinjaによるAPI開発の効率化とリプレースの実践
kashewnuts
1
280
iOSでQRコード生成奮闘記
ktcryomm
2
110
未経験でSRE、はじめました! 組織を支える役割と軌跡
curekoshimizu
1
170
Learning Kotlin with detekt
inouehi
1
150
Rails 1.0 のコードで学ぶ find_by* と method_missing の仕組み / Learn how find_by_* and method_missing work in Rails 1.0 code
maimux2x
1
250
もう僕は OpenAPI を書きたくない
sgash708
6
1.9k
Ça bouge du côté des animations CSS !
goetter
2
160
Amazon Bedrockマルチエージェントコラボレーションを諦めてLangGraphに入門してみた
akihisaikeda
1
150
Formの複雑さに立ち向かう
bmthd
1
940
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
How GitHub (no longer) Works
holman
314
140k
Typedesign – Prime Four
hannesfritz
41
2.5k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Building an army of robots
kneath
303
45k
It's Worth the Effort
3n
184
28k
4 Signs Your Business is Dying
shpigford
183
22k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Automating Front-end Workflow
addyosmani
1369
200k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
134
33k
Transcript
YUMEMI.swift #9 モックフレームワーク⽐較 適切なツールを使いテストを楽にしよう
Jierong Li (李) • 株式会社ゆめみ • iOSエンジニア • 趣味でAndroidとFlutter開発 •
永遠にリリースできず個⼈開発 • https://jierong.dev ⾃⼰紹介
• ⼊⼿しにくい(できない) • テストで使いたい結果を返さな い • 実⾏に時間がかかるなどの、望 ましくない副作⽤がある • 出⼒を検証しにくい(できな
い) なぜモック
⽐較するフレームワーク ステータス ⭐ 初回リリース⽇ バージョン Mockolo 288 2019年9⽉ 1.2.4 Cuckoo
1.3k 2016年1⽉ 1.4.1 Mockingbird 211 2019年8⽉ 0.14.1
⽐較するフレームワーク 分類 • ⾃作⾵ • Mockolo • Mockito⾵ • Cuckoo
• Mockingbird
Mockolo ⾃作⾵ • 単純なコード⽣成 • 導⼊簡単 • 取り除きも簡単 • 機能不⾜
Cuckoo・Mockingbird Mockito⾵
ソース指定 • Mockolo:ディレクトリー/ファイル+サフィックス排除+ノーテーション • Cuckoo:ファイル/グロブ(gub)パターン • Mockingbird:ターゲット+個別排排除 • 共通: f
i nal class
ソース指定 Mockolo • --sourcedirs • --source f i les •
--exclude-su f f i xes • --annotation
ソース指定 Cuckoo • ファイルベース • --glob • *、?、などのワイルドカードでファイル名のセットを指定
ソース指定 Mockingbird • --targets • .mockingbird-ignore • 対策 • ⽣成スピード:キャッシュ
• ビルドスピード:Thunk Stubs
• 暗黙的にデフォルト実装が使わ れ、無効なテストが作る恐れが ある • ないとテストで実⾏されるとこ ろ全部スタブする必要がある デフォルト実装
スタブシーケンス
引数チェック 実装
引数チェック テスト
実⾏順番
予想外のコール 余計なことしないのも⼤事
まとめ Mockolo Cuckoo Mockingbird 依存性 低い ⾼い ⾼い ソース指定 ホワイトリスト
ホワイトリスト ブラックリスト デフォルト実装 デフォルトオン デフォルトオフ デフォルトオフ スタブシーケンス × ◦ ◦ 引数チェック △ ◦ ◦ 実⾏順番 × × ◦ 予想外のコール × ◦ △ Objective-C サポート × ◦ × 既存問題 ? 2+件 ?
既存問題 Cuckoo
Thanks!
参考 • Mockolo • Cuckoo • Mockingbird • テストダブル -
Wikipedia • グロブ - Wikipedia