Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is TestNodeFileArtifact the way we report attachments in MTP? #4934

Open
bradwilson opened this issue Feb 6, 2025 · 3 comments
Open

Is TestNodeFileArtifact the way we report attachments in MTP? #4934

bradwilson opened this issue Feb 6, 2025 · 3 comments
Assignees
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library Area: Server Mode External: Test Explorer

Comments

@bradwilson
Copy link

bradwilson commented Feb 6, 2025

I'm trying to do the Microsoft.Testing.Platform equivalent to VSTest's TestResult.Attachments to add attachments from xUnit.net v3.

This test:

using System.IO;
using Xunit;

namespace Empty;

public class UnitTest
{
    [Fact]
    public void Passing()
    {
        var bytes = File.ReadAllBytes("logo-128-transparent.png");

        TestContext.Current.AddAttachment("Note", "This is important information");
        TestContext.Current.AddAttachment("Logo", bytes, "image/png");
    }
}

Yields this output when run, which seems reasonable:

xUnit.net v3 Microsoft.Testing.Platform Runner v1.1.0-pre.11-dev+4fdcdbe543 (64-bit .NET 8.0.12)

  In process file artifacts produced:
    - For test 'Empty.UnitTest.Passing': C:\...\Note.txt
    - For test 'Empty.UnitTest.Passing': C:\...\Logo.png

Test run summary: Passed! - bin\Debug\net8.0\cs.dll (net8.0|x64)
  total: 1
  failed: 0
  succeeded: 1
  skipped: 0
  duration: 91ms

(Paths shortened for clarity)

Q1: Is this the correct replacement for attachments?


Running the test in Test Explorer in MTP mode, does not yield any attachments:

Image

Compared to running the test in Test Explorer in VSTest mode:

Image

Q2: Am I doing something wrong? Or does Test Explorer not yet support attachments like this?

@Youssef1313 Youssef1313 added the Area: MTP Belongs to the Microsoft.Testing.Platform core library label Feb 7, 2025
@nohwnd
Copy link
Member

nohwnd commented Feb 7, 2025

I see attachments to be described in the protocol. but the only 2 mentions of the update messages are in the docs:

https://grep.app/search?q=AttachmentUpdatesParams

is this implemented for vs @drognanar ?

@bradwilson
Copy link
Author

bradwilson commented Feb 7, 2025

I don't see AttachmentUpdatesParams in the libraries, only in the protocol definition: https://github.com/search?q=repo%3Amicrosoft%2Ftestfx%20AttachmentUpdatesParams&type=code

@Evangelink
Copy link
Member

I confirm this is also not working for MSTest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: MTP Belongs to the Microsoft.Testing.Platform core library Area: Server Mode External: Test Explorer
Projects
None yet
Development

No branches or pull requests

5 participants