Skip to content

Instantly share code, notes, and snippets.

@mheap
Last active June 22, 2016 16:28
Show Gist options
  • Save mheap/fbc3900f18e0f91319350f01ab7ae133 to your computer and use it in GitHub Desktop.
Save mheap/fbc3900f18e0f91319350f01ab7ae133 to your computer and use it in GitHub Desktop.

Capturing an API's behaviour with Behat

Once an API is shipped it doesn't matter if it behaves as originally intended - how it actually behaves is the important part. Consumers depend on it's existing behaviour and we need a way to capture that and ensure that it doesn't change. This is where Behat comes in. Behat is a BDD tool that was built to help design software, but it’s actually a fantastic tool for testing APIs after they have been developed too.

We’ve successfully used this technique to give us the confidence to refactor 5+ year old applications by capturing the existing behaviour before making any changes. Now, I want to share the secrets we learned with you. You don't need existing Behat or testing experience, just a desire to prevent breaking changes in your API.

@elazar
Copy link

elazar commented Jun 21, 2016

Abstract is a bit short. Maybe add in whether the audience needs to have any previous Behat experience to be able to follow the talk? The title could also stand work: I'd never heard the phrase "characterisation test" before now.

@mheap
Copy link
Author

mheap commented Jun 22, 2016

I've expanded a little more about why it's important and changed the title. I'm going to resubmit for a little more feedback

@elazar
Copy link

elazar commented Jun 22, 2016

s/it's existing behaviour/its existing behaviour/g

Otherwise, looks good. 👍

@dfeldman
Copy link

I think you need to define BDD and squeeze in why it's important

@wenz
Copy link

wenz commented Jun 22, 2016

not an expert on English grammar at all, but you might need a comma before the "too". Apart from that, thumbs up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment