7
votes

I have my github project configured for automated builds in Azure Pipelines. Under "Pipelines/Builds/" I can click on "..." and select "Status badge".

Inside pipelines, code coverage is already measured: I can select a specific build, and go to the tab "Code coverage". However, I can't find any link to the coverage badge. Is it provided by Azure Devops? Or is there any free tool that integrates with Azure Devops to provide this?

1

1 Answers

9
votes

You can get a coverage badge for Azure Pipelines by using shields.io:

  1. go to https://shields.io/category/coverage
  2. select Azure Devops coverage
  3. As the website instructs, you need to find out organization, project and definition id. Head to the Azure pipelines, and open the view where you can see the history of builds for your project. The URL will contain all 3 values, e.g. dev.azure.com/ikamenshchikov/flynt/_build?definitionId=1
  4. enter the values you have found in Azure into shields.io blank fields, and click Copy Badge URL to get an URL to the image. You will get an URL like e.g. https://img.shields.io/azure-devops/coverage/ikamenshchikov/flynt/1.
  5. now you can use this url to add the shield to e.g. your github README.md. Add the text ![Coverage](https://img.shields.io/azure-devops/coverage/ikamenshchikov/flynt/1)