Skip to content

Add support for junit test result #4268

Closed

Description

Summary

Add support for junit test result.

Background and Motivation

The junit test result format is having way wider support than TRX and adding support would allow to integrate even further with ecosystem.

Proposed Feature

Add junit test result format.

Activity

  1. added
    area/mtp-extensions
    on Dec 7, 2024
  2. Youssef1313 commented on May 28, 2025

    @Youssef1313
    Member

    Keep in mind that xunit already shipped --report-junit. If we will use the same naming for our command-line option (to be aligned with --report-trx), it means that our package will not be compatible with xunit. So xunit users must stick with xunit's implementation of junit and cannot use ours.

    I generally think that xunit should have shipped their junit reporter as a separate package.

  3. Evangelink commented on May 29, 2025

    @Evangelink
    MemberAuthor

    It's probably not a problem. I mean we can sync with him to move the impl at platform level meaning there would be no need for his impl.

  4. fmaeseele commented on Aug 26, 2025

    @fmaeseele

    Hi,
    I have done most of the work in my company.
    Please find the attached zip. I have a file diretory.build.props that defines a lot of things. So this requires more work to be integrated in a compliant way in testfx. Also, whatever inside the folder "platform" is internal in testfx, so if this code should be integrated, this folder should be removed and code adapted.
    My code works just fine with our jenkins under the new Microsft Testing Platform.
    It would be great if it could be natively integrated.

    Note: The code was written considering my context with .net9 only. I didn't care of other .net versions.
    Kind Regards,
    François

    JUnitReport.zip

  5. bradwilson commented on Apr 12, 2026

    @bradwilson

    Keep in mind that xunit already shipped --report-junit.

    I recognized this as a potential problem and our 4.0 release renames all our reports to include xunit in the name:

      --report-xunit-ctrf              Enable generating CTRF (JSON) report
      --report-xunit-ctrf-filename     The name of the generated CTRF (JSON) report
      --report-xunit-html              Enable generating HTML report
      --report-xunit-html-filename     The name of the generated HTML report
      --report-xunit-junit             Enable generating JUnit (XML) report
      --report-xunit-junit-filename    The name of the generated JUnit (XML) report
      --report-xunit-nunit             Enable generating NUnit v3 (XML) report
      --report-xunit-nunit-filename    The name of the generated NUnit v3 (XML) report
      --report-xunit-trx               Enable generating TRX (XML) report
      --report-xunit-trx-filename      The name of the generated TRX (XML) report
      --report-xunit-xml               Enable generating xUnit.net v2+ (XML) report
      --report-xunit-xml-filename      The name of the generated xUnit.net v2+ (XML) report
    

    We also added an additional MSBuild "kill switch" to remove all our reports:

    <XunitRegisterBuiltInResultWriters>false</XunitRegisterBuiltInResultWriters>

    Unfortunately, this is also new to 4.0, so this doesn't help older versions.

    We will be shipping 4.0 sometime in the next couple months, if that's helpful.

  6. Evangelink commented on Apr 13, 2026

    @Evangelink
    MemberAuthor

    @bradwislon is there anything really specific to xunit in the junit plugin? If not, could we consider making it "global"?

  7. bradwilson commented on Apr 13, 2026

    @bradwilson

    is there anything really specific to xunit in the junit plugin?

    It is based on our object model, not on the MTP object model, since our reports work in both modes.

    Porting it would be possible (and since it's open source and both our projects are "owned" by .NET Foundation, fairly simple from a legal perspective), but the code as-is is not usable outside xUnit.net.

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

Metadata

Metadata

Labels

area/mtp-extensions

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions