Courseiva
Design and implement build and release pipelinesmediumMultiple ChoiceObjective-mapped

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

You are designing a build pipeline for a Node.js application. The pipeline must run unit tests and publish code coverage results to Azure Pipelines. Which task should you use to ensure coverage results are available in the pipeline summary?

⚠ Common exam trap

Many exam-takers confuse PublishTestResults@2 (which publishes test outcomes) with PublishCodeCoverageResults@1 (which publishes coverage metrics), assuming a single task handles both, when in fact Azure Pipelines requires separate tasks for test results and code coverage.

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

PublishCodeCoverageResults@1

The PublishCodeCoverageResults@1 task is specifically designed to publish code coverage results (e.g., Cobertura, JaCoCo, or .coverage formats) to Azure Pipelines, making them visible in the pipeline summary and the Tests tab. This task consumes coverage data files generated by a previous test run and integrates them into the pipeline's reporting UI.

Answer analysis

Option-by-option breakdown

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

  • PublishTestResults@2

    Why it's wrong here

    This task publishes test results from test result files (e.g., JUnit, NUnit, VSTest) to the pipeline, but it does not process or publish code coverage data. Code coverage is a separate concern typically handled by PublishCodeCoverageResults@1, which accepts Cobertura or JaCoCo coverage files.

  • VSTest@2

    Why it's wrong here

    This task is designed for running Visual Studio Test Platform tests, mainly for .NET frameworks (MSTest, xUnit, NUnit) using VSTest.console.exe. It is not applicable for Node.js applications that use testing frameworks like Jest, Mocha, or Karma, and it does not publish code coverage reports.

  • CopyFiles@2

    Why it's wrong here

    This task copies files from source to a destination (e.g., staging directory) but does not interpret or publish coverage data. It lacks the capability to parse coverage files and generate the coverage summary in the pipeline UI, which is why it cannot fulfill the requirement.

  • PublishCodeCoverageResults@1

    Why this is correct

    PublishCodeCoverageResults@1 is the correct task because it directly consumes coverage report files in Cobertura or JaCoCo format and renders an interactive coverage summary in the Azure DevOps pipeline UI, including per-file and line-level percentages. It is language-agnostic, so it works for Node.js applications as long as the test runner (e.g., Jest with the Istanbul/Cobertura reporter) produces the required XML artifact. Unlike tasks that merely copy files or publish test outcomes, this task parses the coverage data and exposes it for direct visibility and monitoring within the pipeline.

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.