API Copilot

Write testing or data population scenarios for your APIs.

This tool provides a pattern to run sequential asynchronous steps while avoiding callbacks with the use of promises. It also includes a promise-based HTTP client based on the request library. Promises are provided by the q library.

var ioc = require('./ioc');


Components

  • scenario.js - the class used to define data population or testing scenarios;
  • scenario.ext.client.js - scenario extensions to make HTTP calls;
  • client.js - a promise-based HTTP client around the request library.
  • cli.logger.js - a command line logger that listens to scenario events;
  • cli.command.js - class responsible for parsing the configuration file and command line options;
  • cli.js - function that runs API Copilot in the current working directory.


Exports

When requiring api-copilot, the following things are provided:

  • Scenario - the class used to define scenarios (see scenario.js);
  • cli - a function that runs API Copilot in the current working directory;
var copilot = require('api-copilot');
copilot.cli(process.argv)
  • version - the semantic version string (e.g. 1.2.3).
module.exports = {
  Scenario: ioc.create('scenario'),
  cli: ioc.create('cli'),
  version: require('../package').version
};