BDD and Interacting With External Resources

Hi all,

What’s the best way to handle features which rely on an
external API in a behaviour-driven way? Suppose I have an app which
manages
online ordering from several independent stores, with a cut taken from
each
purchase, and I want to add a feature whereby orders made by phone that
were facilitated by the website can be tracked so that the cut can be
taken. I discover that I can use Twilio to generate a phone number for
each
store and set up a controller to generate Twiml that results in callers
to
that phone number hearing a recording warning them that their call will
be
recorded then redirecting them to the store’s real number, with a URL of
the recording being sent back to the controller after hangup. How would
I
drive out the desired behaviour (which can be seen as either “the app
generates the proper twiml and stores the relevant call data” or “the
app
routes and records calls” depending on your perspective) from the
outside-in? I don’t know how to write a Cucumber step definition that
ensures that a phone rings!

Cheers,
Shea

On Dec 29, 2010, at 12:01 AM, Shea Levy wrote:

Hi all,

What’s the best way to handle features which rely on an external API in a
behaviour-driven way? Suppose I have an app which manages online ordering from
several independent stores, with a cut taken from each purchase, and I want to add
a feature whereby orders made by phone that were facilitated by the website can be
tracked so that the cut can be taken. I discover that I can use Twilio to generate
a phone number for each store and set up a controller to generate Twiml that
results in callers to that phone number hearing a recording warning them that
their call will be recorded then redirecting them to the store’s real number, with
a URL of the recording being sent back to the controller after hangup. How would I
drive out the desired behaviour (which can be seen as either “the app generates
the proper twiml and stores the relevant call data” or “the app routes and records
calls” depending on your perspective) from the outside-in? I don’t know how to
write a Cucumber step definition that ensures that a phone rings!

The behavior of the app is to set up the Twimi correctly, so I’d specify
that with an automation tool like RSpec or Cucumber. You can do a manual
system test to prove the phone rings.

I’m sure there are other opinions.

Cheers,
David