Demo of Javascript API testing using Mocha and Supertest.
yarn test
ornpm test
.- To generate a specification document from the tests
yarn document
ornpm run document
, the output is in the markdown file specs.md.
The tests are written in a specification like format, and the results can optionally be written out to a markdown file using yarn document
, e.g. specs.md, this allows a living documentation approach where the tests/specs are used to generate validated system documentation that is guaranteed to be up to date.
For a more data driven approach using the same tools the tests could be generated programmatically by iterating over collections of endpoints, REST verbs and expected results, like this.