AZ-400 Question 29
Single answerYour team maintains a microservices-based application with automated tests running in Azure Pipelines. They want to track test pass/fail rates, code coverage, and the average test duration for each build. Additionally, they need to monitor trends over time and display the metrics on a shared dashboard. Which approach should you implement to meet these requirements using the built-in features of Azure DevOps?
- A
Use the Publish Test Results task in Azure Pipelines and store code coverage data in an external coverage analysis tool, then import the results into a spreadsheet for manual monthly reporting.
- B
Configure the Publish Test Results and Publish Code Coverage tasks in Azure Pipelines, enable the Analytics view in Azure DevOps, and create an Analytics-based dashboard or Power BI report for detailed insights.
- C
Leverage Azure Boards queries to filter work items related to testing and create a query that exports pass/fail data for manual trend tracking.
- D
Generate a JUnit test report artifact from each build and store it in an Azure Blob container, then consolidate results with a script that manually produces monthly coverage graphs.
Show answer and explanation
Correct answer: B
Explanation
Using the Publish Test Results and Publish Code Coverage tasks is a best practice for collecting test metrics in Azure Pipelines. Enabling Azure DevOps Analytics allows automatic aggregation of results, trend analysis, and the creation of real-time dashboards. This setup aligns with Microsoft documentation on tracking test quality, code coverage, and pipeline health (docs: https://learn.microsoft.com/azure/devops/).
- A. Incorrect.
Option 1: This approach involves a partially manual process, exporting test results to an external tool and then to a spreadsheet. While possible, it doesn't leverage Azure DevOps Analytics or offer automated trend tracking and dashboards.
- B. Correct.
Option 2: This is correct. By using both the Publish Test Results and Publish Code Coverage tasks, you can automatically capture all test-related metrics. Enabling the Analytics view in Azure DevOps allows you to create dynamic dashboards that update with each build or connect to Power BI for advanced analytics and trend visualization.
- C. Incorrect.
Option 3: Azure Boards queries are mainly used for work item management rather than comprehensive test metrics. Although you can link some test-related items to work items, this process would not provide complete visibility of code coverage or automated test duration trends.
- D. Incorrect.
Option 4: Storing JUnit results in a Blob container and manually parsing them would require significant overhead. It provides no direct integration with Azure DevOps Analytics, making it harder to automate dashboard creation and continuously monitor trends.