ABOUT
Simple api-test module for node.js
INSTALL
npm install devpunx-api-tests
USE
- Define tests in a json5 file
- Integrate it in your code or use as standalone
Test definitions
- protocol: String [http | https]
- host: String [hostname]
- port: Number [port] default: port is defined by protocoll [80 | 443]
- UseBasicAuth: Object
- username: String
- password: String default = false
- tests: Object
- name: String
- path: String
- parameter: Array
- method: String [GET|POST|PUT|DELETE]
- expected: Object
- statusCode: Number
Example:
Setup and run the tests with the path to test-definition file
// Create new Testlet myTests = pathname to test-definition file// Run the testsmyTests
Example
const Test = let myTest = __dirname + '/tests'
Test results are shown in the console as table.