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
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
9.4k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
3.2k
プロダクトの成長を支えるKPI / KPIs for growing your product
hedjirog
17
4k
UIViewPropertyAnimatorで実現するリッチなアニメーション表現
hedjirog
4
2.6k
ReactorKit at Wantedly
hedjirog
2
1.1k
ReactorKitを利用した緩やかなアーキテクチャの移行
hedjirog
3
1.6k
限られたリソースで進める段階的なSwit移行
hedjirog
2
5.5k
エンジニア・デザイナーで取り組むグロースハック
hedjirog
6
2.5k
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
ソフトウェアDNAとクラウドエージェントのススメ
cloudace
0
120
Goodbye ShellScript, Hello File-based App
shunsock
0
670
Railsのように考える: See through the Master
snoozer05
PRO
5
1.2k
.NET WebAssemblyで実現するクライアントサイドAI推論:NuGetからViteまで、2つのエコシステムを繋ぐビルド戦略
yamachu
1
460
AI時代、データエンジニアが一番おもろい
genshun9
0
680
「どのログを見ればいい?」 から始めた サーバーレス障害解析
y_waka1
1
120
C#未経験の僕がAIに読めるコードを書かせるまで
maguroalternative
0
230
AIは推し活である。
kurazuuuuuu
1
940
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
880
データ_AIの事業の勝敗をわけるもの
nek0128
1
470
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
25
17k
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
390
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
We Have a Design System, Now What?
morganepeng
55
8.3k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
670
Code Reviewing Like a Champion
maltzj
528
40k
From π to Pie charts
rasagy
1
380
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
230
Claude Code のすすめ
schroneko
67
230k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
280
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
200
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