rigorous
Mocking and testing utilities for developing APIs with Swagger/OpenAPI
Quickstart
Run a mock server
The following example starts a mock server that hosts each of the spec files in the specified folder. The server will restart when any of the spec files are updated. The regex determines which files should be run. But default, any file ending with .oas2.json
will be run.
const watch = ; ;
Generate integration tests
The following example will generate Mocha tests for negative cases based on the provided specs. The tests can then be run as you would run any suite of Mocha tests.
const fs = ; const createTestCases createBadParameters createMethodNotAllowed createMissingParameters createSmokeTests generate = ; const spec = fs; ;
How to:
Run this project
- Build the code:
npm run build
- Run it!
npm start
Create and run tests
- Add tests by creating files with the
.tests.ts
suffix - Run the tests:
npm t
- Test coverage can be viewed at
/coverage/lcov-report/index.html