swagger-coverage-postman
v1.1.0
Published
Generate API coverage between your Swagger definition and Postman collection
Downloads
9
Maintainers
Readme
swagger-coverage-postman
Generate API coverage between your Swagger definition and Postman collection
Usage
npm install --save swagger-coverage-postman
const coverage = require("swagger-coverage-postman");
const refParser = require("json-schema-ref-parser");
// Load swagger file
const apiFile = path.join(__dirname, "api.yaml");
const api = await refParser.dereference(apiFile);
// Load postman integration test file
const integrationTestsFile = path.join(__dirname, "integration-tests.json");
const integrationTests = require(integrationTestsFile);
// Calculate coverage summary
const coverageSummary = await coverage.summary(api, integrationTests);
console.log(coverageSummary);
// { paths: 1, methods: 0.86, parameters: 0.15 }