openapi3-tester
Simple customizable testing for APIs defined with OpenAPI v3 spec
Leaves choosing what to send and what details to assert to you while automating all validations against the OpenAPI spec.
Closest thing to automatically-generated test suite that still makes sense long term
Install
npm i --save-dev openapi3-tester
Features
- validates input for tests, so tests can't remain outdated when API specification changes
- automatically tests response for the expected status
- allows a human to specify input so failing cases are easier to do than with a test generator
reqOptions
is passed torequest
package, so there's no limit to the complexity of requests to test- tracks coverge of the API definition
Usage
see test.js
for an example
const API = apiTester
Coverage
API tester has a tiny coverage tracking feature. It's very basic, but should be helpful in tracking which endpoints are missing a test.
API.getCoverageNumbers()
lists entries from the definition and the number of calls in teests that matched the definition. Warning: default
as response code will match all calls to that path and method, even if matching code is defined separately.
To get an insight into how coverage was matched to request, call API.getCoverage()
and see the matchers.