Closed reggi closed 8 years ago
Interesting. This is totally dependent on your technology stack though. If it allows measurement of code coverage when running certain external commands, maybe it's possible.
E.g: If I were using Python's unittest
module, I could probably write a test-case that calls Newman, and generate code coverage reports using something like coveralls.
I don't think there's any chance of having such a functionality built into Newman however, because of the number of different technologies people use to build their APIs.
describe('newman', () => {
// done on the next line is a function that marks the current test as asynchronous
it('should run collection correctly', function (done) {
this.timeout(100000); // 10 seconds
newman.run({
collection: (require('../API-Automation.postman_collection.json')),
environment: (require('../dev_environment.postman_environment.json')),
reporters: 'cli'
}, (err, summary) => {
console.log(summary.run.failures.length);
if (err) { return done(err); }
done();
});
});
});
Plug it with nyc/istanbul so we can capture coverage on same server instance !! this will help a lot i am still trying to figure this out how can be done with node APIs
Not even sure what this really entails. But the idea is I'd like to pipe in newman tests to account for my code coverage. Is this something that is possible?