How to send a detailed report through email notification when testcases are run through azure pipeline?

Stephen Chacko 20 Reputation points
2025-09-29T23:16:40.61+00:00

I'm running automation testcases in azure pipeline using yaml. I've used Cypress automation tool and automated salesforce. After the completion of running the pipeline, i'm getting a email on the test results as follows:

User's image

I wanted the test results to be bit more detailed. Instead of total passed/failed, I want the email to have which testcases got passed/failed. Is there a way to achieve it.

Thanks in advance

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
0 comments No comments
{count} votes

Answer accepted by question author
  1. niraj 75 Reputation points
    2025-09-30T13:48:36.3166667+00:00

    To get detailed test case reports in your emails, you need to add a custom step to your pipeline to parse the results and send a custom notification.

    Here are the required steps:

    Step 1: Generate a Detailed Test Report

    Configure your test tool (Cypress) to output a machine-readable report file. The standard format for this is JUnit XML. You'll need to add a JUnit reporter to your Cypress configuration.

    Step 2: Publish the Test Results

    In your YAML pipeline, use the PublishTestResults@2 task. This task officially publishes the JUnit XML file, making the detailed results available to the pipeline.

    Step 3: Add a Custom Script to Send the Email

    Add a PowerShell task to the end of your pipeline. This script is responsible for:

    1. Finding and reading the JUnit XML report file.
    2. Parsing the file to get the status of each individual test case.
    3. Building an HTML string that lists the passed and failed tests.
    4. Sending this HTML as the body of an email.

    Step 4: Securely Manage Your Credentials

    Store your email server details (SMTP server, recipient list, etc.) in a secure Variable Group within your Azure DevOps project's Library. Do not hardcode them in your YAML file. Link this variable group to your pipeline to make the credentials available to your script.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.