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.
npm install -g swagger-tester
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
- any http or https remote file:
- [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
For tests examples take a look into examples folder.
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.