News for hackers. Stuff that matters.
Re:Twitter Completely Down by mootothemax on Thursday June 21, 2012 @12:52PM (#4142923)
Always fun when you're developing against an API, and then have to perform a frantic investigation to work out if your latest code change broke everything... or it's just the API endpoint itself.
Re:Twitter Completely Down by auxbuss on Thursday June 21, 2012 @02:15PM (#4143410)
In ruby, at least, there are some good tools to automate this for you. Using, say, vcr, you can automatically "record" your API calls (into "cassettes") as your tests run; these data are then used when you run your unit tests subsequently. When you plan to integrate/push, simply delete the "cassettes" and run your tests again. That way, any API changes are picked up prior to integration.

I have a suite here that takes about 3 minutes to run from scratch, but just over 1 second as unit tests.

Re:Twitter Completely Down by zmoazeni on Thursday June 21, 2012 @12:55PM (#4142939)
I had this problem years ago against the Twitter API. It took a shot of rum and a cigarette before I figured it out. And I'm not a smoker.
Re:Twitter Completely Down by DanielN on Thursday June 21, 2012 @01:14PM (#4143065)
Unit test ( as already mentioned) and build up static json/xml/whatever files to run your code against so that you can integration test your stuff without integration testing the 3rd party stuff.
Re:Twitter Completely Down by Retric on Thursday June 21, 2012 @01:38PM (#4143212)
And hope your static files still match the API behavior when your done...
Re:Twitter Completely Down by timdorr on Thursday June 21, 2012 @02:11PM (#4143389)
That's actually a completely valid test to run: what happens when the API's results change on you? You should test that.
Re:Twitter Completely Down by DanielN on Thursday June 21, 2012 @01:47PM (#4143259)
At some point you end up outside of the scope of testing, but you can build bootstraps to make sure that your mocks match whatever they are mocking.

Obviously, this does you no good when something like an API service goes down, but that's issue is irrelevant to the question that was posed. Having some static file to test against whether it is accurate or not will instantly tell you whether it is your code or the third party that is breaking.

Re:Twitter Completely Down by ckdarby on Thursday June 21, 2012 @12:58PM (#4142960)
This is what unit testing is for