Skip to content

[Discussion] Should Microsoft.Testing.Platform support CTRF (Common Test Report Format)? #8858

Closed

Description

Summary

CTRF (Common Test Report Format) is an emerging open standard that defines a unified JSON format for test outcomes across languages and frameworks. The goal is to make test results portable across tools and platforms (reporters, dashboards, CI integrations, AI agents, etc.) without each consumer having to learn TRX, JUnit XML, xUnit XML, NUnit XML, and the various bespoke formats.

The CTRF maintainers explicitly call out C#/.NET as a language where they'd welcome a native implementation, and Microsoft.Testing.Platform (MTP) already has a pluggable report-extension model (TrxReport, HtmlReport, AzureDevOpsReport, …) which makes it a natural home for a first-party reporter.

This issue is to gather opinions on whether MTP should ship native support for CTRF — either as a built-in extension (Microsoft.Testing.Extensions.CtrfReport) following the same pattern as the existing report extensions, or as a documented community extension point.

Questions for the discussion

  1. Is there enough adoption / momentum behind CTRF to warrant first-party support in MTP, or should we wait until the spec hits v1.0.0?
  2. If we do support it, should it be a built-in extension (like TRX/HTML) or live out-of-tree?
  3. Are there gaps in the CTRF schema (e.g., around .NET-specific concepts like data-driven tests, dynamic data, test contexts, retries, hangdumps, in-process logs) that would prevent it from carrying everything we currently expose via TRX?
  4. How does this interact with the existing TRX report extension — do we want feature parity, or is CTRF intended to be a simpler complement?

Reference

Cc

/cc Brad Wilson (@bradwilson) — you appear in the CTRF contributors list and obviously have a unique perspective from the xUnit side; would love your take on whether MTP supporting CTRF natively would be valuable, and on any pitfalls you've already hit on the xUnit end.

Activity

  1. bradwilson commented on Jun 5, 2026

    @bradwilson

    My appearance in the contributors list is the equivalent of me finding a typo, so not substantive. 😂

    xUnit.net's CTRF support was added at the due to a user request: xunit/xunit#1052 (comment) (which turned into xunit/xunit#2942).

    CTRF from us is about equal in size to our XML, and less than half the size of TRX. (HTML is much smaller, but contains a LOT less information.)

    $ dir .\artifacts\test
    
        Directory: C:\Dev\xunit\xunit\4.0\artifacts\test
    
    Mode                 LastWriteTime         Length Name
    ----                 -------------         ------ ----
    -a---         2026-Jun-03    15:50       14006736 v3.ctrf
    -a---         2026-Jun-03    15:50        6811247 v3.html
    -a---         2026-Jun-03    15:50       30049769 v3.trx
    -a---         2026-Jun-03    15:50       13020026 v3.xml

    I like the CTRF format because it's extensible, so we can support all the standard values and then add our own extensions. Over time, if they codify some of the things we do as extensions, we can move those values over into the standards. I would go so far as to say if xUnit.net were being invented today, we would just choose CTRF and not invent our own format. We are currently using the standard CTRF test result reporter in GitHub actions.

    Success example:

    Failure example:

    There are definitely improvements I'd make here (in particular, I'd like to see the formatted stack trace and message for failures, which are standard parts of CTRF), but on the whole it serves the main purpose of the report. The suite ID isn't particularly useful here, but I haven't come up with an alternative I like better than using our computed ID (could use assembly path + config file path, I suppose, since 99% of users never pass custom config files).


    If you look at our result writer (starting at ResultWriterMessageHandler.cs#L85), you can see what we put into standard values vs. extensions (anything sitting in an object named extra is outside the spec). The things that are extensions today include:

    • Inside the top level /results element:
      • Non-standard environment information (computer name, user name)
      • The metadata about "test suites" (for us, one per test assembly), including:
        • Environment and timing information
        • A list of test collections
        • A list of errors (non-test failures)
    • Inside of /results/summary/tests, per test:
      • We separate traits named Category as CTRF standard tags
      • As extras, we add CLR type and method names, output, warnings, traits, and CLR exception type for failures
  2. Evangelink commented on Jun 7, 2026

    @Evangelink
    MemberAuthor

    I saw your name but haven't checked the content of your contributions, sorry 😞

    Thanks for the detailed output, it seems pretty cheap to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions