Precept 0.14.0

Precept.Reporting.Teams

Microsoft Teams reporting for Precept: one Adaptive Card per run, posted to an incoming webhook, with the verdict, the counts, the pass rate, and a link to the build that produced them.

dotnet add package Precept.Reporting.Teams
public sealed class Startup : IPreceptStartup
{
    public void ConfigureServices(IServiceCollection services, PreceptSettings settings) =>
        services.AddPreceptTeamsReporting(teams => teams.Variant = PreceptTeamsCardVariant.Pipeline);
}
{
  "Reporting": {
    "Teams": {
      "Variant": "Pipeline",
      "NotifyOn": "Failure",
      "Title": "Checkout regression",
      "Facts": { "Owner": "Checkout squad" }
    }
  }
}

The webhook URL is a credential: anyone holding it can post to the channel. Supply it from CI as the PRECEPT_REPORTING__TEAMS__WEBHOOKURL environment variable rather than committing it. Create it from the channel's Workflows connector. The payload is the Adaptive Card envelope a workflow URL expects, not the retired Office 365 connector's MessageCard.

Variants#

Variant picks the layout, in code as above, in precept.json, or as PRECEPT_REPORTING__TEAMS__VARIANT for a single run.

Variant Card
Summary (default) Verdict header, the counts as tiles, the pass rate, the environment. No failure messages.
Compact One line: verdict, pass rate, duration, and the button.
Detailed Summary, then the failed tests and their messages, capped by MaxFailuresListed and MaxFailureMessageLength.
Pipeline Summary, then the build: pipeline, build number, branch, commit, who queued it.

The pipeline facts are read from the agent's own variables (Azure DevOps and GitHub Actions), so nothing is configured into the test project. Off an agent, the Pipeline variant renders the summary it is built on rather than a table of blanks. The same detection gives every variant its button: leave RunUrl unset and the card links to the build that ran the suite.

The card links the run's other reports. Register Precept.Reporting.ReportPortal or Precept.Reporting.AzureDevOps alongside it and the card gets a button per destination, Open ReportPortal and Open Azure DevOps. There is nothing to configure, because each of those reporters posts the address it opened to PreceptRunLinks during the run. "LinkToOtherReports": false turns the buttons off. See linking a run's reports to each other.

ImageUrl puts a picture on the card, such as a pipeline status badge or a team logo. It must be an https address every reader's Teams client can fetch without signing in, because the card renders in their client and not on the agent. ImagePlacement takes Thumbnail (the default, beside the heading), Banner (full width) or None.

Cards are posted from a build agent only, so a channel hears about the pipeline's runs and not about every run somebody starts while writing a scenario. A developer's run posts nothing and asks for nothing. The reporter is never started, so a missing webhook is not an error there. To post from your own machine while working on the card, add { "Reporting": { "CiOnly": false } } to precept.local.json. See CI and local runs for how a run is recognised as CI.

The card is one HTTP call after the last test, built from the summary Precept already keeps. Nothing is sent per test. NotifyOn takes Always, Failure or FailureOrFlaky. The last one is how a green-but-retried run still gets noticed.


Part of Precept, a .NET 10 test framework built on Microsoft.Testing.Platform. Full documentation: reporting · what the Teams card looks like · running a suite on CI · configuration · writing your own reporter

Precept 0.14.0 · MIT · © 2026

Esc