I'm using frisby.js for implementing automated Rest API tests together with Mocha. All tests are implemented in a separate testautomation project. The REST API implementations are implemented in other projects. The Rest API is based on Swagger. So, I'm able to reach/get the swagger.json
as API definition.
Here is a simple example of an implementation:
const frisby = require('frisby');
const chai = require('chai');
const assert = chai.assert;
const config = require('config');
const { adminUser1 } = config.get('users');
const { adminUser2 } = config.get('users');
const restHelper = require('../restHelper');
describe('REST API endpoint \'/auth\' on environment: ' + process.env.BASE_URL + '/api/auth', () => {
// POST /auth
describe('POST /auth', () => {
// POST /auth - Status Code 200
describe('Status Code 200', () => {
it('create a new session for user ' + adminUser1.username, () => {
return frisby
.post(process.env.BASE_URL + '/api/auth', {
'username': adminUser1.username,
'password': adminUser1.password,
})
.expect('status', 200)
.then(function (result) {
assert.isNotNull(result.json.token);
});
});
});
});
});
Now I want to get an information about the test coverage for this Rest API. So, I want to get an overview what is already tested and which API endpoints are not covered at this time.
Are there any tools, packages, etc. to generate and implement such a test coverage report?