Frisby.js - The Easiest REST API Testing Framework Out There

Frisby makes REST API testing easy, fast, and fun. Frisby.js comes loaded with many built-in tools for the most common things you need to test for to ensure your REST API is working as it should, and returning the correct properties, values, and types.

When you need something custom, Frisby.js also provides an easy way to customize and extend assertions to make your job easier, with less repetitive and tedious code.

A Simple Example

The most basic check of ensuring a URL returns a specific status code:

const frisby = require('frisby'); ​ it ('should return a status of 200', function () { return frisby .get('http://api.example.com') .expect('status', 200); });

Checking a JSON Response Body

A more useful and thorough test might make several assertions on the actual JSON response. Frisby.js makes this easy:

const frisby = require('frisby'); const Joi = frisby.Joi; // Frisby exports Joi for convenience on type assersions ​ ​ it ('should return a status of 200', function () { return frisby .get('https://jsonfeed.org/feed.json') .expect('status', 200) .expect('json', 'version', 'https://jsonfeed.org/version/1') .expect('json', 'title', 'JSON Feed') .expect('jsonTypes', 'items.*', { // Assert *each* object in 'items' array 'id': Joi.string().required(), 'url': Joi.string().uri().required(), 'title': Joi.string().required(), 'date_published': Joi.date().iso().required(), }); });

Gain Confidence In Your API

Check out the Getting Started page to setup Frisby.js in your project.

Happy testing!