Mock the internet
Hi, I'm writing a framework for web API like flickr. However, I don't want my test failed depending on the server status. (And I don't want it hit the server every time I build my project.) Is there any easy way to fake the network layer? I don't think swizzle the NSURLConnection is enough because the HTTP intermediate framework my project depends use CFNetwork. Conditional compile and mocking the response inside the HTTP intermediate framework is bad since it's not even my code. Any suggestion for this? Regards, yllan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mock the internet
On 8 Nov 2010, at 09:53, Yung-Luen Lan wrote: Hi, I'm writing a framework for web API like flickr. However, I don't want my test failed depending on the server status. (And I don't want it hit the server every time I build my project.) Is there any easy way to fake the network layer? I don't think swizzle the NSURLConnection is enough because the HTTP intermediate framework my project depends use CFNetwork. Conditional compile and mocking the response inside the HTTP intermediate framework is bad since it's not even my code. During development cannot you not target a local http instance that doesn't support the full API but simply returns an acknowledgment/error response. A faked network layer doesn't sound appealing. Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mock the internet (with my crumby native English corrected)
On 8 Nov 2010, at 09:53, Yung-Luen Lan wrote: Hi, I'm writing a framework for web API like flickr. However, I don't want my test failed depending on the server status. (And I don't want it hit the server every time I build my project.) Is there any easy way to fake the network layer? I don't think swizzle the NSURLConnection is enough because the HTTP intermediate framework my project depends use CFNetwork. Conditional compile and mocking the response inside the HTTP intermediate framework is bad since it's not even my code. A faked network layer doesn't sound appealing. If I read this right you require an efficient response from the server component. During development can you not target a local httpd instance that doesn't support the full API but simply returns an acknowledgment/error response? You could even build such a responder into your own app and activate it only for development builds. Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mock the internet (with my crumby native English corrected)
On 2010 Nov 08, at 04:56, jonat...@mugginsoft.com wrote: Jonathan gave good answers but you're probably going to need a little more help. During development can you not target a local httpd instance that doesn't support the full API but simply returns an acknowledgment/error response? These might get you started: http://en.wikibooks.org/wiki/Mac_OS_X_Tiger/Using_your_Mac_as_a_Web_Server http://techtrouts.com/mac-os-x-105-web-sharing-forbidden-403-on-httplocalhostusername/ You could even build such a responder into your own app and activate it only for development builds. I considered doing that a year or so ago. Search the archives of MacNetworkProg list macnetworkp...@lists.apple.com. Also, you should ask any further questions over there since it's a more appropriate list for this kind of thing. Either way, you'll find it to be somewhat involved. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mock the internet
There are a couple of options I have used.. 1.) User your mac's local web server. 2.) MAMP which includes a full Web Server with mySQL. http://www.mamp.info/en/index.html. I use this later a lot for creating and testing custom backend services and client calls locally. Scott Andrew On Nov 8, 2010, at 1:53 AM, Yung-Luen Lan wrote: Hi, I'm writing a framework for web API like flickr. However, I don't want my test failed depending on the server status. (And I don't want it hit the server every time I build my project.) Is there any easy way to fake the network layer? I don't think swizzle the NSURLConnection is enough because the HTTP intermediate framework my project depends use CFNetwork. Conditional compile and mocking the response inside the HTTP intermediate framework is bad since it's not even my code. Any suggestion for this? Regards, yllan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40roadrunner.com This email sent to scottand...@roadrunner.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com