Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hantuzun/jetman
A better tool for testing APIs
https://github.com/hantuzun/jetman
api-test api-testing javascript-library jetman-test npm postman postman-collection rest-api
Last synced: 2 months ago
JSON representation
A better tool for testing APIs
- Host: GitHub
- URL: https://github.com/hantuzun/jetman
- Owner: hantuzun
- License: mit
- Created: 2016-05-21T23:10:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-27T21:33:12.000Z (almost 7 years ago)
- Last Synced: 2024-09-18T11:02:13.345Z (4 months ago)
- Topics: api-test, api-testing, javascript-library, jetman-test, npm, postman, postman-collection, rest-api
- Language: JavaScript
- Homepage: https://npmjs.com/package/jetman
- Size: 71.3 KB
- Stars: 26
- Watchers: 7
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A better tool for testing APIs------------------------------------------------------------------------------------------------------------------------
## Why?
Jetman aspires to be the best tool for testing APIs.[Postman](https://www.getpostman.com), [Runscope](https://www.runscope.com/) or [SoapUI](https://www.soapui.org/) 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`
```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`
```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](https://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](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](https://gitter.im/hantuzun/jetman)!
## Testing
Run `npm test`. This command runs unit tests and tests the project for [JavaScript Standard Style](http://standardjs.com/) compatibility.## License
[MIT](LICENSE)[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](http://forthebadge.com)
[![Analytics](https://ga-beacon.appspot.com/UA-78341852-1/chromeskel_a/readme?pixel)](http://hantuzun.com)