How to attach files to test results
Attaching files to test results with .NET tests & NUnit
NUnit.Framework.TestContext.AddTestAttachment(attachmentPath, "My attachment");Attaching files to test results with .NET tests & MsTest
[Binding]
public class MyStepDefinitions
{
private readonly TestContext _testContext;
public MyStepDefinitions(TestContext testContext)
{
_testContext = testContext;
}
[When(@"a test attachment is saved")]
public void WhenATestAttachmentIsSaved()
{
string attachmentPath = // save attachment & calculate attachment path
_testContext.AddResultFile(attachmentPath);
}
}Test execution frameworks that do not support test attachments
Last updated