Frisby.js: REST API Endpoint Testing built on Jasmine
A node.js NPM module that makes testing API endpoints easy, fast and fun.
Install Frisby from NPM:
npm install frisby
Frisby tests start with
frisby.create with a description of the test followed by one of
head, and ending with
run to generate the resulting jasmine spec test. There is a
expectStatus method built in to more easily test HTTP status codes. Any other jasmine
expect tests should be done inside the
Each set of unique sequences or API endpoint tests should be started with new
frisby.toss method calls instead of trying to chain multiple HTTP requests together.
var frisby = ;var URL = '';var URL_AUTH = '';frisby;frisby// 'afterJSON' automatically parses response body as JSON and passes it as an argument;
Any of the Jasmine matchers can be used inside the
afterJSON callbacks to perform additional or custom tests on the response data.
Frisby is built on top of the jasmine BDD spec framework, and uses the excellent jasmine-node test runner to run spec tests in a specified target directory.
Files must end with
spec.js to run with jasmine-node.
Suggested file naming is to append the filename with
npm install -g jasmine-node
cd your/project jasmine-node .