AZ-400 exam dumps

AZ-400 practice question 121 of 306

Designing and Implementing Microsoft DevOps Solutions. Professional level, Microsoft. Free question with the correct answer and a full explanation.

AZ-400 Question 121

Select 2

You are implementing an Azure DevOps pipeline for a .NET solution that includes unit tests. The team wants to measure and display code coverage results in the pipeline summary after each build. Which two actions must you include in your YAML pipeline to properly generate and publish code coverage data?

  1. A

    Include a Visual Studio Test task with the �Enable Code Coverage� option selected to generate coverage data.

  2. B

    Use a Publish Code Coverage Results task referencing the coverage report generated by the test task.

  3. C

    Configure a custom PowerShell script to parse the .trx file and manually upload the coverage details.

  4. D

    Add a separate code coverage tool like Coverlet without any modifications to the YAML pipeline tasks.

Show answer and explanation

Correct answers: A, B

Explanation

To properly implement code coverage analysis in Azure DevOps for a .NET application, you typically use the 'Visual Studio Test' task with coverage enabled, then use 'Publish Code Coverage Results' to display the metrics in the pipeline summary. This aligns with best practices documented in the official Azure DevOps Test documentation (https://docs.microsoft.com/azure/devops/pipelines/tasks/test/visual-studio-test). Manually parsing files or simply adding a coverage library without configuring the pipeline tasks is insufficient to generate and publish coverage data automatically.

  • A. Correct.

    Correct. With .NET solutions, using the Visual Studio Test task and enabling code coverage is a straightforward way to generate coverage data. This task automatically collects coverage metrics.

  • B. Correct.

    Correct. After coverage data is generated, you must publish it so that the pipeline can display the results. The Publish Code Coverage Results task loads the coverage report into the pipeline summary.

  • C. Incorrect.

    Incorrect. While you could parse .trx files manually, Azure DevOps provides built-in tasks to handle coverage rendering and publishing. Manually parsing .trx files would be unnecessarily complex and prone to errors.

  • D. Incorrect.

    Incorrect. Simply adding Coverlet as a reference without integrating coverage tasks in YAML will not automatically collect or publish code coverage in Azure DevOps. You still need tasks to generate and publish coverage reports.

Timed practice exam

Take a AZ-400 practice test under exam conditions

70 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam