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
SwiftでHTTP通信のスタブ化 / Stubbing HTTP Requests in S...
Search
Jiro Nagashima
February 28, 2015
Technology
9.3k
4
Share
SwiftでHTTP通信のスタブ化 / Stubbing HTTP Requests in Swift
#33testing
Jiro Nagashima
February 28, 2015
More Decks by Jiro Nagashima
See All by Jiro Nagashima
グロースを加速するLooker活用 / Leveraging Looker to accelerate growth
hedjirog
3
3k
プロダクトの成長を支えるKPI / KPIs for growing your product
hedjirog
17
3.9k
UIViewPropertyAnimatorで実現するリッチなアニメーション表現
hedjirog
4
2.5k
ReactorKit at Wantedly
hedjirog
2
1k
ReactorKitを利用した緩やかなアーキテクチャの移行
hedjirog
3
1.5k
限られたリソースで進める段階的なSwit移行
hedjirog
2
5.4k
エンジニア・デザイナーで取り組むグロースハック
hedjirog
6
2.4k
iOS 10 時代のアニメーション / Introduction to UIViewPropertyAnimator
hedjirog
3
3.1k
How we use fastlane at Wantedly
hedjirog
9
11k
Other Decks in Technology
See All in Technology
自立を加速させる神器 - EMOasis #11
stanby_inc
0
140
2026年、知っておくべき最新 サーバレスTips10選/serverless-10-tips
slsops
13
5.2k
Eight Engineering Unit 紹介資料
sansan33
PRO
3
7.3k
Shipping AI Agents — Lessons from Production
vvatanabe
0
240
AWS認定資格は本当に意味があるのか?
nrinetcom
PRO
2
270
The Journey of Box Building
tagomoris
4
2.7k
生成AIが変える SaaS の競争原理と弁護士ドットコムのプロダクト戦略
bengo4com
0
700
ARIA Notifyについて
ryokatsuse
1
120
AgentCore×VPCでの設計パターンn選と勘所
har1101
3
280
クラウドネイティブな開発 ~ 認知負荷に立ち向かうためのコンテナ活用
literalice
0
130
Azure Static Web Apps の自動ビルドがタイムアウトしやすくなった状況に対応した件/global-azure2026
thara0402
0
410
AIでAIをテストする - 音声AIエージェントの品質保証戦略
morix1500
1
120
Featured
See All Featured
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
310
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
120
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
130
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
How to make the Groovebox
asonas
2
2.1k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Raft: Consensus for Rubyists
vanstee
141
7.4k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
230
Between Models and Reality
mayunak
3
270
Transcript
4XJGU Ͱ )551௨৴ͷελϒԽ !IFEKJSPH
ͳ͕͠·͡Ζ͏ !IFEKJSPH 4BOTBOגࣜձࣾ&JHIU
)551௨৴ͷελϒԽ
/-5)5514UVC4FSWFS ैདྷख๏ 0))5514UVCT FUD…
ΞϓϦ෦ͷαʔόʔ ैདྷख๏ /463-1SPUPDPMʹ४ڌͨ͠Ϋϥε .FUIPE4XJ[[MJOH
ʷΞϓϦ෦ͷαʔόʔ ैདྷख๏ ʷ/463-1SPUPDPMʹ४ڌͨ͠Ϋϥε ʷ.FUIPE4XJ[[MJOH
.PZB
None
None
.PZB w ωοτϫʔΫपΓͷநԽϨΠϠʔ w ςετ༻ͷελϒѻ͑Δ
Πϝʔδ͜Μͳײ͡ IUUQEFWFMPQFSIBUFOBTUBGGDPNFOUSZTNBSUBQJDMJFOUXJUITXJGU VTJOHFOVNBOEHFOFSJDT
IFEKJSPH2JJUB'FFE
"1*ͷهड़
enum QiitaAPI { case Items case TagItems(String) } FOVNఆٛ
extension QiitaAPI : MoyaPath { var path: String { switch
self { case .Items: return "/api/v2/items" case .TagItems(let tagID): return "/api/v2/tags/\(tagID)/items" } } } ύεࢦఆ
extension QiitaAPI : MoyaTarget { var baseURL: NSURL { return
NSURL(string: "https://qiita.com")! } var sampleData: NSData { switch self { case .Items, .TagItems: return stubbedResponse("Items") } } } B63-ࢦఆ
extension QiitaAPI : MoyaTarget { var baseURL: NSURL { return
NSURL(string: "https://qiita.com")! } var sampleData: NSData { switch self { case .Items, .TagItems: return stubbedResponse("Items") } } } CελϒԽͨ͠ϨεϙϯεΛࢦఆ
ϓϩόΠμͷΓସ͑
static func DefaultProvider() -> ReactiveMoyaProvider<QiitaAPI> { return ReactiveMoyaProvider(endpointsClosure: endpointsClosure) }
static func StubbingProvider() -> ReactiveMoyaProvider<QiitaAPI> { return ReactiveMoyaProvider(endpointsClosure: endpointsClosure, stubResponses: true) } ϓϩόΠμఆٛ
QiitaProvider.sharedProvider = QiitaProvider.StubbingProvider() Γସ͑
IUUQTHJUIVCDPNBSUTZFJEPMPO ࢀߟ IUUQTHJUIVCDPN"TI'VSSPX.PZB σϞ IUUQTHJUIVCDPNIFEKJSPH2JJUB'FFE