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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Jiro Nagashima
February 28, 2015
Technology
4
9.3k
SwiftでHTTP通信のスタブ化 / Stubbing HTTP Requests in Swift
#33testing
Jiro Nagashima
February 28, 2015
Tweet
Share
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
Data Hubグループ 紹介資料
sansan33
PRO
0
2.7k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
10Xにおける品質保証活動の全体像と改善 #no_more_wait_for_test
nihonbuson
PRO
0
110
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
100
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
1
310
変化するコーディングエージェントとの現実的な付き合い方 〜Cursor安定択説と、ツールに依存しない「資産」〜
empitsu
4
1.3k
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
1
170
MCPでつなぐElasticsearchとLLM - 深夜の障害対応を楽にしたい / Bridging Elasticsearch and LLMs with MCP
sashimimochi
0
120
Introduction to Bill One Development Engineer
sansan33
PRO
0
360
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
400
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
Featured
See All Featured
Odyssey Design
rkendrick25
PRO
1
490
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
The Spectacular Lies of Maps
axbom
PRO
1
510
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
820
AI: The stuff that nobody shows you
jnunemaker
PRO
2
230
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Raft: Consensus for Rubyists
vanstee
141
7.3k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
720
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Building AI with AI
inesmontani
PRO
1
670
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
95
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