Bird Stream

Entrepreneurship, development and (sometimes) cycling, often simultaneously, mainly in Nottingham

API Divining With Cucumber and Firefox

I’ve been discovering the wonders of RSpec and Cucumber recently (I know, I know, I’m horribly late to that particular party) and revelling in how the BDD > TDD cycle helps keep one focused on the feature being delivered.

Rest APIs are a common topic of conversation among the Esendex dev team and it was a conversation with @jbjon and @samwessel this week that inspired an experiment.

We were discussing HATEOAS whereby a REST client needs no prior knowledge about how to interact with any particular application or server beyond a generic understanding of hypermedia. Your API shouldn’t be fixed but should be discoverable. Clients shouldn’t be locked into a tight coupling with your API but should be able to adapt has it changes.

What also came up was the notion that the mark of a well tested system was that you could through away all of your code and be confident that you could rebuild it completely based on the tests.

So I set myself an exercise. Could I build an API by putting myself in the shoes of a developer discovering the API for the first time. My tools Cucumber and Firefox.

Screen_shot_2011-10-27_at_23

Comments