jetman

0.4.0 • Public • Published

Jetman

A better tool for testing APIs

NPM Version Build Status Dependencies JavaScript Standard Style Gitter License


Why?

Jetman aspires to be the best tool for testing APIs.

Postman, Runscope or SoapUI are nice tools for testing APIs; however, their tests can only be created from their graphical user interfaces. Writing and maintaining tests on these GUIs is a pain compared to text editors. Moreover, these tests cannot be secured and shared under version control systems or cannot be debugged easily.

With Jetman you can write your API tests in JavaScripts files and solve all these problems. Jetman can also execute your tests or save them as Postman collections.

How to Use Jetman?

  • Create a node project for testing your API and require Jetman: jetman = require('jetman');
  • Write your test modules in JavaScript files.
  • Call jetman.execute(tests) with your test modules.

Here is a simple application for running one Jetman test:

index.js
jetman = require('jetman');
var test = require('./test.js');
 
jetman.execute([test]);

How to Write Jetman Tests?

Jetman tests are JavaScript files on your test project. They must expose a run() function and inside that they should call jetman.send(request, testFunction) method to use Postman. In this function request is a Postman request object and testFunction is an optional test function.

Below is an example test module:

test.js
var request =  {
  'name': 'Root endpoint works',
  'method': 'GET',
  'url': 'localhost:9090'
}
 
function test() {
  tests['Status code is 200'] = responseCode.code === 200;
  tests['Response time is less than 500ms'] = responseTime < 500;
}
 
exports.run = function () {
  jetman.send(request, test);
}

Example Project

An example API test project using Jetman is at: github.com/hantuzun/jetman-example.

Documentation

Jetman can execute tests with options and callback. It can also save your tests as Postman collections.

For full documentation refer to docs.

Development

Clone the repo and install dependencies with npm install. It's recommended to use Jetman from another module with tests.

Write to us on our Jetman Gitter Chat Room!

Testing

Run npm test. This command runs unit tests and tests the project for JavaScript Standard Style compatibility.

License

MIT

forthebadge

Analytics

Package Sidebar

Install

npm i jetman

Weekly Downloads

0

Version

0.4.0

License

MIT

Unpacked Size

17.6 kB

Total Files

9

Last publish

Collaborators

  • emrehan