SlideShare a Scribd company logo
Automatic testing of
(RESTful) API documentation
API Days Paris, December 2016
By Rouven Weßling ( )
Ecosystem Developer / Developer Evangelist, Contentful
@RouvenWessling
photo credit: byMusée du Louvre Dustin Gaffke (CC-BY)
A content management developer platform with an API at its core.
What do you do?
Powered by
Documentation will be wrong
Users hate that
It's all in the spec
api blueprint
A powerful high-level API description language for web APIs.
## Questions Collection [/questions]
### Create a New Question [POST]
You may create your own question using this action. It takes a JSON
object containing a question and a collection of answers in the
form of choices.
+ Request (application/json)
{
"question": "Favourite programming language?",
"choices": [
"Swift",
"Python",
"Objective-C",
"Ruby"
]
}
+ Response 201 (application/json)
+ Headers
Location: /questions/2
+ Body
{
"question": "Favourite programming language?",
"published_at": "2015-08-05T08:40:51.620Z",
"choices": [
{
"choice": "Swift",
Let's get testing
DREDD
No more outdated API documentation.
Testing read-only
node_modules/.bin/dredd cma.apib https://api.contentful.com 
-m GET
Hooks
beforeAll called at the beginning of the whole test run
beforeEach called before each HTTP transaction
before called before some specific HTTP transaction
beforeEachValidation called before each HTTP transaction is validated
beforeValidation called before some specific HTTP transaction is validated
after called a er some specific HTTP transaction regardless its result
afterEach called a er each HTTP transaction
afterAll called a er whole test run
Hooks
node_modules/.bin/dredd cma.apib https://api.contentful.com 
--hookfiles=./test-hooks.js 
-m GET
Skipping Tests
var hooks = require('hooks');
hooks.before(
"Webhook calls > Webhook call details > Get the webhook call details",
function (transaction) {
transaction.skip = true;
});
Mutating data
var hooks = require('hooks');
hooks.before(
"Entries > Delete an Entry",
function (transaction) {
client.createEntry(entry, "1234")
});
Rate limiting
var hooks = require('hooks');
const DELAY = 1000/6.0;
hooks.afterEach(function(transaction, done) {
setTimeout(done, DELAY);
});
Changing request data
var hooks = require('hooks');
hooks.beforeEach(function (transaction, done) {
transaction.fullPath = transaction.fullPath.replace('fp91oelsziea', 'gbkxklvmolc1');
done();
});
Chai assertions
var hooks = require('hooks');
var assert = require('chai').assert;
hooks.afterEach(function(transaction, done) {
if (!transaction.skip) {
assert.match(transaction.real.headers['x-contentful-request-id'], /^content-api:[a-zA-Z0-9]{22}$/
}
done();
});
Security
Censor private data
var hooks = require('hooks');
const SECRET_HEADERS = ['Authorization'].map(header => header.toLowerCase());
hooks.afterEachValidation(function(transaction, done) {
Object.keys(transaction.request.headers).forEach(function(key) {
if (SECRET_HEADERS.indexOf(key.toLowerCase()) > -1) {
transaction.request.headers[key] = "***HIDDEN SECRET DATA***";
}
});
done();
});
CI the beast
Conclusion
Base your documentation on an API spec
Test that spec
Make it part of your CI
Don't substitute your integration tests
Slides available on Slideshare: http://www.slideshare.net/rwessling/api-days-
paris-automatic-testing-of-restful-api-documentation
Follow me on Twitter: @RouvenWessling

More Related Content

What's hot

Wrangling WP_Cron - WordCamp Grand Rapids 2014
Wrangling WP_Cron - WordCamp Grand Rapids 2014Wrangling WP_Cron - WordCamp Grand Rapids 2014
Wrangling WP_Cron - WordCamp Grand Rapids 2014
cklosowski
 
PWA 與 Service Worker
PWA 與 Service WorkerPWA 與 Service Worker
PWA 與 Service Worker
Anna Su
 
Teaching Native Qt to Talk Web
Teaching Native Qt to Talk WebTeaching Native Qt to Talk Web
Teaching Native Qt to Talk Web
Alan Uthoff
 
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
DynamicInfraDays
 
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
Codemotion
 
Deploying a Location-Aware Ember Application
Deploying a Location-Aware Ember ApplicationDeploying a Location-Aware Ember Application
Deploying a Location-Aware Ember Application
Ben Limmer
 
Grails Plugins
Grails PluginsGrails Plugins
Grails Plugins
NexThoughts Technologies
 
Rntb20200805
Rntb20200805Rntb20200805
Rntb20200805
t k
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8
Smita B Kumar
 
Service workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsService workers and the role they play in modern day web apps
Service workers and the role they play in modern day web apps
Mukul Jain
 
The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)
The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)
The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)
David Pichsenmeister
 
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
NexThoughts Technologies
 
Background Jobs with Resque
Background Jobs with ResqueBackground Jobs with Resque
Background Jobs with Resque
homanj
 
Service workers
Service workersService workers
Service workers
jungkees
 
GPerf Using Jesque
GPerf Using JesqueGPerf Using Jesque
GPerf Using Jesque
ctoestreich
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
Workhorse Computing
 
Advanced redux
Advanced reduxAdvanced redux
Advanced redux
Boris Dinkevich
 
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
Shengyou Fan
 
Wix Automation - Core
Wix Automation - CoreWix Automation - Core
Wix Automation - Core
Efrat Attas
 
Service Worker Presentation
Service Worker PresentationService Worker Presentation
Service Worker PresentationKyle Dorman
 

What's hot (20)

Wrangling WP_Cron - WordCamp Grand Rapids 2014
Wrangling WP_Cron - WordCamp Grand Rapids 2014Wrangling WP_Cron - WordCamp Grand Rapids 2014
Wrangling WP_Cron - WordCamp Grand Rapids 2014
 
PWA 與 Service Worker
PWA 與 Service WorkerPWA 與 Service Worker
PWA 與 Service Worker
 
Teaching Native Qt to Talk Web
Teaching Native Qt to Talk WebTeaching Native Qt to Talk Web
Teaching Native Qt to Talk Web
 
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
ContainerDays NYC 2016: "OpenWhisk: A Serverless Computing Platform" (Rodric ...
 
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
 
Deploying a Location-Aware Ember Application
Deploying a Location-Aware Ember ApplicationDeploying a Location-Aware Ember Application
Deploying a Location-Aware Ember Application
 
Grails Plugins
Grails PluginsGrails Plugins
Grails Plugins
 
Rntb20200805
Rntb20200805Rntb20200805
Rntb20200805
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8
 
Service workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsService workers and the role they play in modern day web apps
Service workers and the role they play in modern day web apps
 
The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)
The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)
The Hitchhikers Guide To Html5 Offline Strategies (+firefoxOS)
 
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
 
Background Jobs with Resque
Background Jobs with ResqueBackground Jobs with Resque
Background Jobs with Resque
 
Service workers
Service workersService workers
Service workers
 
GPerf Using Jesque
GPerf Using JesqueGPerf Using Jesque
GPerf Using Jesque
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
 
Advanced redux
Advanced reduxAdvanced redux
Advanced redux
 
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
 
Wix Automation - Core
Wix Automation - CoreWix Automation - Core
Wix Automation - Core
 
Service Worker Presentation
Service Worker PresentationService Worker Presentation
Service Worker Presentation
 

Viewers also liked

حاسب
حاسبحاسب
حاسب
szxc22
 
Display Georgian College Academic Transcript
Display Georgian College Academic TranscriptDisplay Georgian College Academic Transcript
Display Georgian College Academic TranscriptAngie Lacoursiere
 
Fuzi11 1
Fuzi11 1Fuzi11 1
Fuzi11 1
Ichsan Izatul
 
API World 2016 - API Mashup - Combining for Fun and Profit
API World 2016 - API Mashup - Combining for Fun and ProfitAPI World 2016 - API Mashup - Combining for Fun and Profit
API World 2016 - API Mashup - Combining for Fun and Profit
Rouven Weßling
 
The OpenStack Contribution Workflow
The OpenStack Contribution WorkflowThe OpenStack Contribution Workflow
The OpenStack Contribution Workflow
openstackindia
 
Debunking Common Myths of Hadoop Backup & Test Data Management
Debunking Common Myths of Hadoop Backup & Test Data ManagementDebunking Common Myths of Hadoop Backup & Test Data Management
Debunking Common Myths of Hadoop Backup & Test Data Management
Imanis Data
 
Pre-Con Education: Shift-Left Performance Testing for Shift-Forward Quality
Pre-Con Education: Shift-Left Performance Testing for Shift-Forward QualityPre-Con Education: Shift-Left Performance Testing for Shift-Forward Quality
Pre-Con Education: Shift-Left Performance Testing for Shift-Forward Quality
CA Technologies
 
Pronouns & possessives
Pronouns & possessivesPronouns & possessives
Pronouns & possessives
Susana Barajas
 
How WebRTC ushers the next wave of e-Learning innovation
How WebRTC ushers the next wave of e-Learning innovationHow WebRTC ushers the next wave of e-Learning innovation
How WebRTC ushers the next wave of e-Learning innovation
Tsahi Levent-levi
 
Economics at university switzerland
Economics at university switzerlandEconomics at university switzerland
Economics at university switzerland
hasansawaar
 
BDD along with Continuous Integration
BDD along with Continuous IntegrationBDD along with Continuous Integration
BDD along with Continuous Integration
Agile Testing Alliance
 
Test Engagement - Vishal Prasad
Test Engagement - Vishal PrasadTest Engagement - Vishal Prasad
Test Engagement - Vishal Prasad
Agile Testing Alliance
 
Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...
Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...
Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...
CA Technologies
 
Accident Investigation Basics Training by Washington State Department of Labo...
Accident Investigation Basics Training by Washington State Department of Labo...Accident Investigation Basics Training by Washington State Department of Labo...
Accident Investigation Basics Training by Washington State Department of Labo...Atlantic Training, LLC.
 

Viewers also liked (17)

حاسب
حاسبحاسب
حاسب
 
Display Georgian College Academic Transcript
Display Georgian College Academic TranscriptDisplay Georgian College Academic Transcript
Display Georgian College Academic Transcript
 
Fuzi11 1
Fuzi11 1Fuzi11 1
Fuzi11 1
 
Máy cưa đĩa Makita MT583
Máy cưa đĩa Makita MT583Máy cưa đĩa Makita MT583
Máy cưa đĩa Makita MT583
 
API World 2016 - API Mashup - Combining for Fun and Profit
API World 2016 - API Mashup - Combining for Fun and ProfitAPI World 2016 - API Mashup - Combining for Fun and Profit
API World 2016 - API Mashup - Combining for Fun and Profit
 
The OpenStack Contribution Workflow
The OpenStack Contribution WorkflowThe OpenStack Contribution Workflow
The OpenStack Contribution Workflow
 
Debunking Common Myths of Hadoop Backup & Test Data Management
Debunking Common Myths of Hadoop Backup & Test Data ManagementDebunking Common Myths of Hadoop Backup & Test Data Management
Debunking Common Myths of Hadoop Backup & Test Data Management
 
Pre-Con Education: Shift-Left Performance Testing for Shift-Forward Quality
Pre-Con Education: Shift-Left Performance Testing for Shift-Forward QualityPre-Con Education: Shift-Left Performance Testing for Shift-Forward Quality
Pre-Con Education: Shift-Left Performance Testing for Shift-Forward Quality
 
Pronouns & possessives
Pronouns & possessivesPronouns & possessives
Pronouns & possessives
 
How WebRTC ushers the next wave of e-Learning innovation
How WebRTC ushers the next wave of e-Learning innovationHow WebRTC ushers the next wave of e-Learning innovation
How WebRTC ushers the next wave of e-Learning innovation
 
Economics at university switzerland
Economics at university switzerlandEconomics at university switzerland
Economics at university switzerland
 
BDD along with Continuous Integration
BDD along with Continuous IntegrationBDD along with Continuous Integration
BDD along with Continuous Integration
 
Test Engagement - Vishal Prasad
Test Engagement - Vishal PrasadTest Engagement - Vishal Prasad
Test Engagement - Vishal Prasad
 
Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...
Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...
Test Data Management 101—Featuring a Tour of CA Test Data Manager (Formerly G...
 
DCS Or PLC
DCS Or PLCDCS Or PLC
DCS Or PLC
 
Accident Investigation Basics Training by Washington State Department of Labo...
Accident Investigation Basics Training by Washington State Department of Labo...Accident Investigation Basics Training by Washington State Department of Labo...
Accident Investigation Basics Training by Washington State Department of Labo...
 
Company profile
Company profileCompany profile
Company profile
 

Similar to API Days Paris - Automatic Testing of (RESTful) API Documentation

Nordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API DocumentationNordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API Documentation
Rouven Weßling
 
vienna.js - Automatic testing of (RESTful) API documentation
vienna.js - Automatic testing of (RESTful) API documentationvienna.js - Automatic testing of (RESTful) API documentation
vienna.js - Automatic testing of (RESTful) API documentation
Rouven Weßling
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
Matthew Groves
 
Full Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQLFull Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQL
All Things Open
 
Velocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web appsVelocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web apps
andrewsmatt
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019
Joe Keeley
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
Francois Zaninotto
 
Quick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerQuick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase Server
Nic Raboy
 
Building Better Web APIs with Rails
Building Better Web APIs with RailsBuilding Better Web APIs with Rails
Building Better Web APIs with Rails
All Things Open
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
darrelmiller71
 
Sharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's FinagleSharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's Finagle
Geoff Ballinger
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
BizTalk360
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
Shumpei Shiraishi
 
Prairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API ResponsesPrairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API Responses
darrelmiller71
 
OneRing @ OSCamp 2010
OneRing @ OSCamp 2010OneRing @ OSCamp 2010
OneRing @ OSCamp 2010
Qiangning Hong
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
PHP Conference Argentina
 

Similar to API Days Paris - Automatic Testing of (RESTful) API Documentation (20)

Nordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API DocumentationNordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API Documentation
 
vienna.js - Automatic testing of (RESTful) API documentation
vienna.js - Automatic testing of (RESTful) API documentationvienna.js - Automatic testing of (RESTful) API documentation
vienna.js - Automatic testing of (RESTful) API documentation
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
Full Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQLFull Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQL
 
Velocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web appsVelocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web apps
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019
 
huhu
huhuhuhu
huhu
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Quick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerQuick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase Server
 
Building Better Web APIs with Rails
Building Better Web APIs with RailsBuilding Better Web APIs with Rails
Building Better Web APIs with Rails
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
Sharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's FinagleSharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's Finagle
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
Prairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API ResponsesPrairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API Responses
 
OneRing @ OSCamp 2010
OneRing @ OSCamp 2010OneRing @ OSCamp 2010
OneRing @ OSCamp 2010
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
 

More from Rouven Weßling

Adapting our API for multiple platforms
Adapting our API for multiple platformsAdapting our API for multiple platforms
Adapting our API for multiple platforms
Rouven Weßling
 
php[world] 2016 - API Mashup - Combining APIs for Fun and Profit
php[world] 2016 - API Mashup - Combining APIs for Fun and Profitphp[world] 2016 - API Mashup - Combining APIs for Fun and Profit
php[world] 2016 - API Mashup - Combining APIs for Fun and Profit
Rouven Weßling
 
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
Rouven Weßling
 
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Introvienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
Rouven Weßling
 
Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016
Rouven Weßling
 
What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?
Rouven Weßling
 

More from Rouven Weßling (7)

Adapting our API for multiple platforms
Adapting our API for multiple platformsAdapting our API for multiple platforms
Adapting our API for multiple platforms
 
php[world] 2016 - API Mashup - Combining APIs for Fun and Profit
php[world] 2016 - API Mashup - Combining APIs for Fun and Profitphp[world] 2016 - API Mashup - Combining APIs for Fun and Profit
php[world] 2016 - API Mashup - Combining APIs for Fun and Profit
 
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
 
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Introvienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
vienna.html - Turn your Blog into Facebook Instant Articles + Contentful Intro
 
Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016
 
What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?
 
Joomla Day DK 2012
Joomla Day DK 2012Joomla Day DK 2012
Joomla Day DK 2012
 

Recently uploaded

Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 

Recently uploaded (20)

Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 

API Days Paris - Automatic Testing of (RESTful) API Documentation

  • 1. Automatic testing of (RESTful) API documentation API Days Paris, December 2016 By Rouven Weßling ( ) Ecosystem Developer / Developer Evangelist, Contentful @RouvenWessling photo credit: byMusée du Louvre Dustin Gaffke (CC-BY)
  • 2. A content management developer platform with an API at its core.
  • 3.
  • 8. It's all in the spec api blueprint A powerful high-level API description language for web APIs.
  • 9. ## Questions Collection [/questions] ### Create a New Question [POST] You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices. + Request (application/json) { "question": "Favourite programming language?", "choices": [ "Swift", "Python", "Objective-C", "Ruby" ] } + Response 201 (application/json) + Headers Location: /questions/2 + Body { "question": "Favourite programming language?", "published_at": "2015-08-05T08:40:51.620Z", "choices": [ { "choice": "Swift",
  • 10. Let's get testing DREDD No more outdated API documentation.
  • 11. Testing read-only node_modules/.bin/dredd cma.apib https://api.contentful.com -m GET
  • 12.
  • 13.
  • 14. Hooks beforeAll called at the beginning of the whole test run beforeEach called before each HTTP transaction before called before some specific HTTP transaction beforeEachValidation called before each HTTP transaction is validated beforeValidation called before some specific HTTP transaction is validated after called a er some specific HTTP transaction regardless its result afterEach called a er each HTTP transaction afterAll called a er whole test run
  • 16. Skipping Tests var hooks = require('hooks'); hooks.before( "Webhook calls > Webhook call details > Get the webhook call details", function (transaction) { transaction.skip = true; });
  • 17. Mutating data var hooks = require('hooks'); hooks.before( "Entries > Delete an Entry", function (transaction) { client.createEntry(entry, "1234") });
  • 18. Rate limiting var hooks = require('hooks'); const DELAY = 1000/6.0; hooks.afterEach(function(transaction, done) { setTimeout(done, DELAY); });
  • 19. Changing request data var hooks = require('hooks'); hooks.beforeEach(function (transaction, done) { transaction.fullPath = transaction.fullPath.replace('fp91oelsziea', 'gbkxklvmolc1'); done(); });
  • 20. Chai assertions var hooks = require('hooks'); var assert = require('chai').assert; hooks.afterEach(function(transaction, done) { if (!transaction.skip) { assert.match(transaction.real.headers['x-contentful-request-id'], /^content-api:[a-zA-Z0-9]{22}$/ } done(); });
  • 22. Censor private data var hooks = require('hooks'); const SECRET_HEADERS = ['Authorization'].map(header => header.toLowerCase()); hooks.afterEachValidation(function(transaction, done) { Object.keys(transaction.request.headers).forEach(function(key) { if (SECRET_HEADERS.indexOf(key.toLowerCase()) > -1) { transaction.request.headers[key] = "***HIDDEN SECRET DATA***"; } }); done(); });
  • 24.
  • 25. Conclusion Base your documentation on an API spec Test that spec Make it part of your CI Don't substitute your integration tests
  • 26. Slides available on Slideshare: http://www.slideshare.net/rwessling/api-days- paris-automatic-testing-of-restful-api-documentation Follow me on Twitter: @RouvenWessling