swagger-tester

1.1.3 • Public • Published

swagger-tester

A framework for testing your swagger 2.0 specifications. Easily can be used as an additional step in Continious Integration. This module is a command line tool. It exits with code 1 if any of the tests fails. And code 0 if all fine.

Installation

npm install -g swagger-tester

Usage

node swagger-tester --specs=./swagger.json --tests=./examples/tests

You will need to provide command line arguments:

  • [Required] Swagger specification file with --specs option. Valid options are:
    • any http or https remote file: https://somebucket.s3.amazonaws.com/somePublicSpecs.json
    • any absolute path: /opt/projects/swagger.json
    • any relative path: ../../specs.json
  • [Required] Path to file or folder with tests with --tests <path> option:
    • ../tests/
    • tests/myapi.js
  • [Optional] Server base url including api version (if any) with --server <your server url>. This, if specified, will override corresponding values in specification.
    • https://api.server.com/v2

Tests

For tests examples take a look into examples folder.

Notes

At the moment only NO SECURITY and JWT SECURITY supported. So you will have to provide api token if you are using JWT. Add --token=<JWT TOKEN HERE> option when launching app to specify token.

Package Sidebar

Install

npm i swagger-tester

Weekly Downloads

1

Version

1.1.3

License

MIT

Last publish

Collaborators

  • metasergey