Learn how to automatically test your API's documentation by using API Blueprints and dredd.
Presented at the Nordic APIs Platform Summit on October 25, 2016
Report
Share
Report
Share
1 of 26
Download to read offline
More Related Content
Nordic APIs - Automatic Testing of (RESTful) API Documentation
1. Automatic testing of (RESTful)
API documentation
Nordic APIs Platform Summit, October 2016
By Rouven Weßling ( )
Ecosystem Developer / Developer Evangelist, Contentful
@RouvenWessling
photo credit: byStockholm, Approaching Blue Hour Tobias Lindman (CC-BY)
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",
14. Hooks
beforeAllcalled at the beginning of the whole test run
beforeEachcalled before each HTTP transaction
beforecalled before some specific HTTP transaction
beforeEachValidationcalled before each HTTP transaction is validated
beforeValidationcalled before some specific HTTP transaction is validated
aftercalled a er some specific HTTP transaction regardless its result
afterEachcalled a er each HTTP transaction
afterAllcalled 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")
});
26. Slides available on Slideshare: http://www.slideshare.net/rwessling/nordic-
apis-automatic-testing-of-restful-api-documentation
Follow me on Twitter: @RouvenWessling