We have REST services created in RestEasy and running in wildfly server. We are running Postman test cases to test the Rest URLs.
Is there a way to get a code coverage of the services when we execute postman test suite?
We use SonarQube to analyse the code coverage.
To calculate the code coverage percentage, simply use the following formula: Code Coverage Percentage = (Number of lines of code executed by a testing algorithm/Total number of lines of code in a system component) * 100.
Postman includes code snippets you add and then change to suit your test logic. To add tests to a request, open the request and enter your code in the Tests tab. Tests will execute after the request runs. The output is in the response's Test Results tab.
Run a test with code coverageOpen the desired file in the Project tool window and choose Run <name> with Coverage from the context menu. You can also select a directory with test files and choose the corresponding command from the context menu to run several tests with coverage.
I think no, a similar question was asked here: Generate Sonar code coverage report from Postman tests
The original poster commented further down:
In fact, after a bit of googling, as a work-around we could use remote Jacoco agent hooked in the java application server. We'll try to run jacoco maven goals before and after the tests execution in order to generate jacoco coverage report. See: link I'll update the post if we have some progress.
Also, newman seems to have aticket about it: https://github.com/postmanlabs/newman/issues/408
Though this might help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With