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:

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

Q2: Am I doing something wrong? Or does Test Explorer not yet support attachments like this?
I'm trying to do the Microsoft.Testing.Platform equivalent to VSTest's
TestResult.Attachmentsto add attachments from xUnit.net v3.This test:
Yields this output when run, which seems reasonable:
(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:
Compared to running the test in Test Explorer in VSTest mode:
Q2: Am I doing something wrong? Or does Test Explorer not yet support attachments like this?