AZ-400 Question 26
Single answerYour DevOps team uses Azure DevOps for continuous integration and deployment of a .NET application. The product owner wants to track code coverage over time to ensure that each pipeline run meets a minimum threshold and to spot regressions quickly. Which approach should you use to gather and visualize code coverage metrics within Azure DevOps?
- A
Enable code coverage in your build pipeline and create a custom Azure Boards query to track coverage values in the team backlog.
- B
Enable code coverage in your build pipeline, publish the coverage results, and use the built-in coverage reporting in Azure Pipelines to view trends over time.
- C
Use GitHub Actions to generate code coverage reports and manually upload the results to Azure Repos for each commit.
- D
Configure an Azure Monitor alert that triggers whenever code coverage falls below your threshold, sending a notification to the operations team.
Show answer and explanation
Correct answer: B
Explanation
To design and implement appropriate metrics for code coverage, you should enable and publish coverage results within your Azure Pipelines build. Azure DevOps includes built-in test coverage reporting, which allows you to see trends, monitor regressions, and compare coverage across builds. Refer to the official Microsoft documentation on publishing code coverage results in Azure Pipelines (https://docs.microsoft.com/azure/devops/pipelines/test/review-code-coverage-results) for detailed instructions on how to configure and interpret these metrics.
- A. Incorrect.
Incorrect. Azure Boards queries are primarily designed to filter and track work items, not to visualize test coverage data over time. While you can attach test results to work items, it does not provide a built-in coverage trend view.
- B. Correct.
Correct. By enabling code coverage in the build pipeline and publishing the results, you can leverage Azure Pipelines� built-in reporting features. This includes dashboards or summary views that show coverage trends and help detect regressions more easily.
- C. Incorrect.
Incorrect. While GitHub Actions can generate code coverage reports, it introduces an unnecessary complexity if your project is primarily using Azure DevOps. Also, manually uploading to Azure Repos is not an efficient or recommended practice for continuous tracking of metrics.
- D. Incorrect.
Incorrect. Azure Monitor focuses on infrastructure and application telemetry (e.g., performance). It is not designed to provide detailed code coverage reporting. You would still need an integrated mechanism that tracks and visualizes coverage trends in the build or release pipeline.