Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get code coverage using postman test

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.

like image 966
Adiant Avatar asked Oct 05 '16 08:10

Adiant


People also ask

How do I get a code coverage test?

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.

How do you test a code on a Postman?

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.

How do you run tests with coverage?

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.


1 Answers

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

like image 59
Bentaye Avatar answered Sep 21 '22 06:09

Bentaye