0
votes

I have been able to generate Angular 4 code coverage in azure devops build pipeline.

Screenshot Of Generated Code Coverage

Screenshot Of Code Coverage Summary

But now I want to get the build coverage details from Azure DevOps Services REST APIs.

I am calling the REST API

https://dev.azure.com/{organization}/{project}/_apis/test/codecoverage?buildId={buildId}&flags={flags}&api-version=5.1-preview.1

of my azure build, as mentioned in

https://docs.microsoft.com/en-us/rest/api/azure/devops/test/code%20coverage/get%20build%20code%20coverage?view=azure-devops-rest-5.1.

But everytime I am getting {"value":[],"count":0} as response.

I need to get the coverage information from Azure DevOps Services REST API so that it can be appended in Email. Looking for help in this regard from this forum.

1

1 Answers

1
votes

You can delete the flags parameter and make the url like this to check if the response body is your expected.

https://dev.azure.com/{orgname}/{projectname}/_apis/test/codecoverage?buildId={buildId}&api-version=5.1-preview.1

In addition, if you just want to append it in Email, you can use Publish code coverage results Task to get the codecoverage artifact and append this in Email. More detailed in formation about this task, you can refer to https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results?view=azure-devops