is your api misbehaving?(keith-casey)
TRANSCRIPT
IS YOUR API MISBEHAVING? D. KEITH CASEY, JR AUSTIN, TX [email protected] @CASEYSOFTWARE
Assumption:
You have a technical background
APIs are an important part of your job
Use them on a regular basis
Potentially build them too
Sometimes public, sometimes private
Assumption:
Nothing is perfect
I make mistakes
You make mistakes
Your providers make mistakes
Those other teams are knuckleheads
API “testing” is Deceptive
Click tests - someone
Unit Tests - xUnit suite
Integration Tests - still probably xUnit
Web/UI Tests - Selenium, Watir, Testlio (mobile), etc
Back to the Drawing Board
SMART Specific, Measurable, Achievable, Relevant, Time-boxed
INVEST Independent, Negotiable, Valuable, Estimable, Small, Testable
Behavior Driven DevelopmentStandard Definition:
BDD is a synthesis and refinement of practices stemming from TDD and ATDD.
Dan North’s Definition (circa 2009):
BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.
Well to be more precise
It’s English, but in the Gherkin syntax so this:
As a [role] I want [feature] so that [benefit]
becomes a feature called:
Given [condition] when I [action] then [result]
In Many LanguagesJava - JBehave
Ruby - RBehave -> RSpec -> Cucumber
PHP - Behat
Python - Behave
C# - NSpec
Javascript - Cucumber-js & Jasmine
For Clarify.ioThe first thing that anyone does:
Creates a bundle (audio or video package)
We need a file (audio in this case)
We need an API key
We need to submit it (POST)
We need to check the results (201 Created)
And then…?
Write the feature
Refactor to reuse when possible
Add the left over bits
GOAL: You should be writing less and less code!
Our StatusWe validate the Helper Libraries with this too
Feature tests for the API using:
Using the PHP library
Using the Python library
Using the Ruby library (newest)(publicly launching our tests this month here: https://github.com/Clarify )
IS YOUR API MISBEHAVING? D. KEITH CASEY, JR AUSTIN, TX [email protected] @CASEYSOFTWARE