Generate Sonar code coverage report from Postman tests Generate Sonar code coverage report from Postman tests jenkins jenkins

Generate Sonar code coverage report from Postman tests


You can run the tests in the localhost environment and this way coverage will be measured as usual. Actually this is a good CI practice since you'll be testing the code you're trying to deploy rather than a previously published version.

To implement the solution you should point the tests URL to localhost (it's a good idea to indicate the host using a environment variable in order to easily switch between local or production environments) and then add pre and post executions in the jenkins project in order to start the local server before execution and stop it afterwards.

This link shows how to implement the solution on node, and this other link shows how to stop the local server after execution)


At present, no such functionality is provided within Newman, as mapping test coverage via an external command is not standardised across various stacks. Making something like this available (and usable) would also involve creating and providing a manifest of all application URL endpoints to Newman (and altering Newman to interpret it as well), so that there is a global namespace to check percentage coverage against.

Please see https://github.com/postmanlabs/newman/issues/408 for more details.