Courseiva
Design and implement build and release pipelineseasyMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement build and release pipelines

You need to run unit tests in your build pipeline and publish the test results to Azure Pipelines. Which task should you use?

⚠ Common exam trap

The trap is that candidates might think the Publish Test Results task is required for all test reporting, but in fact the Visual Studio Test task already includes built-in publishing. You only need a separate Publish Test Results task when using custom test runners that do not publish natively.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Visual Studio Test task

To run unit tests and publish the results in Azure Pipelines, use the Visual Studio Test task. It executes the tests and automatically publishes the test results to the pipeline, providing rich reporting and pass/fail analysis. The Publish Test Results task is only used when you already have test result files (e.g., JUnit, TRX) from a previous step and need to import them; it does not run any tests itself. The DotNetCoreCLI test command can also run and publish results, but the Visual Studio Test task is the standard framework-agnostic choice.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • DotNetCoreCLI task with test command

    Why it's wrong here

    The DotNetCoreCLI task with the test command executes unit tests for .NET projects and produces a TRX or other test result files, but it only generates the results and does not publish them to the pipeline. To make test results visible in the Azure DevOps summary, an additional 'Publish Test Results' task must be added after it.

  • Npm task

    Why it's wrong here

    The Npm task is used for installing, building, and running Node.js package scripts, such as 'npm test' for JavaScript unit tests. It does not have native functionality to publish test result files to the pipeline; a separate 'Publish Test Results' task is required to upload and report those results.

  • Publish Test Results task

    Why it's wrong here

    The Publish Test Results task is the correct choice because it explicitly consumes test result files in formats like TRX, JUnit, and NUnit, and publishes them to Azure Pipelines, making them appear in the Tests tab and build summary. This task is essential after running tests with any test runner, as it provides the report and metrics that Azure DevOps displays.

  • Visual Studio Test task

    Why this is correct

    The Visual Studio Test task runs unit tests using the VSTest console and can produce a TRX file, but it does not directly publish the results to the pipeline. After execution, you still need a 'Publish Test Results' task to upload the TRX file so that the test results appear in the Azure DevOps UI.

About these practice questions

One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.