A better tool for testing APIs
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 = ;var test = ; jetman;
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' { tests'Status code is 200' = responseCodecode === 200; tests'Response time is less than 500ms' = responseTime < 500;} exports { jetman;}
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.