user5576120
user5576120

Reputation: 65

How to get the code coverage from sonar dashboard

Could someone help me to get the code coverage from sonar dashboard through curl REST API call? We are using the Sonar version as 6.7 and I am not able to find the REST call to fetch the same.

Upvotes: 2

Views: 2374

Answers (1)

Maxence Lecointe
Maxence Lecointe

Reputation: 238

you can do this : curl "http://sq_instance:port/api/measures/component?metricKeys=coverage&componentKey=the_project_key"

then you see :

{  
   "component":{  
      "id":"AWmbujtw_he9c8fQXlqh",
      "key":"blablabla",
      "name":"Sample Application",
      "qualifier":"TRK",
      "measures":[  
         {  
            "metric":"coverage",
            "value":"55.2",
            "bestValue":false
         }
      ]
   }
}

anyway you'll find all metrics keys here : https://docs.sonarqube.org/7.4/user-guide/metric-definitions/

Upvotes: 2

Related Questions