AZ-400 exam dumps

AZ-400 practice question 118 of 306

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

AZ-400 Question 118

Single answer

You are configuring a new Azure DevOps YAML pipeline for a .NET application. Your team wants to ensure that unit test results and code coverage are both automatically generated and displayed within the pipeline summary. Which approach should you take to accomplish this?

  1. A

    Use a .NET Core task to run 'dotnet test' with code coverage enabled, followed by a Publish Test Results task to upload the TRX files into the pipeline.

  2. B

    Set the pipeline to skip running any tests locally, then upload a code coverage report as a build artifact for manual inspection.

  3. C

    Add a Visual Studio Test task but disable the 'Publish Test Results' option, relying on logs to identify any failed tests.

  4. D

    Configure a GitHub Actions workflow for unit tests and code coverage, then manually copy the test results to the Azure DevOps pipeline summary.

Show answer and explanation

Correct answer: A

Explanation

In Azure DevOps, the best practice for integrating test executions and code coverage is to run tests within the same pipeline where the application is built, enabling full visibility of test outcomes. Using the .NET Core task to run 'dotnet test' (with the '--collect:' or '--configuration' parameters for coverage) and then adding a Publish Test Results task ensures test metrics and coverage data appear in the pipeline summary. For more details, refer to Microsoft� official documentation: https://docs.microsoft.com/azure/devops/pipelines/test/test-execution.

  • A. Correct.

    Correct: Running tests using the .NET Core task with code coverage enabled generates both test result TRX files and coverage data. The Publish Test Results task then integrates these test results directly into the pipeline summary, showing pass/fail metrics and coverage information.

  • B. Incorrect.

    Incorrect: Uploading coverage as a build artifact without running tests in the pipeline bypasses the built-in test result integration. This provides minimal visibility into failing tests or coverage at the pipeline level.

  • C. Incorrect.

    Incorrect: Disabling 'Publish Test Results' means the pipeline won't show test details in the summary. While logs may capture failures, this approach fails to leverage the integrated test result view in Azure DevOps.

  • D. Incorrect.

    Incorrect: Switching to GitHub Actions for tests and then manually copying results into Azure DevOps creates unnecessary complexity and does not provide automatic test result integration within the Azure DevOps pipeline.

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