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
540
モックフレームワーク比較 / 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
2.8k
Multi-Module 101
myihsan
0
350
Hierarchical Structure について / About Hierarchical Structure
myihsan
1
510
What’s New in Accessibility WWDC21
myihsan
1
330
Property WrapperでDecodableのデフォルト値を設定 / Providing Default Value for Decodable Property by Property Wrapper
myihsan
1
320
Other Decks in Programming
See All in Programming
Python’s True Superpower
hynek
0
200
ふつうのRubyist、ちいさなデバイス、大きな一年 / Ordinary Rubyists, Tiny Devices, Big Year
chobishiba
1
400
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
110
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
160
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
460
Codex の「自走力」を高める
yorifuji
0
1k
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
480
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
130
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
210
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.6k
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
540
CSC307 Lecture 14
javiergs
PRO
0
450
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
140
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
430
Accessibility Awareness
sabderemane
0
73
How to Think Like a Performance Engineer
csswizardry
28
2.5k
My Coaching Mixtape
mlcsv
0
67
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
130
Documentation Writing (for coders)
carmenintech
77
5.3k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
980
Docker and Python
trallard
47
3.8k
A Soul's Torment
seathinner
5
2.4k
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