We are using Visual Studio 2010 connected to Team Foundation Server 2010 and we use MSTest to create our unit tests.
Is it possible to attach an image to a test report, so when a test fails we can visualize something?
This image can for example be a screenshot of the application for UI tests or a graph visualizing measurement data.
Use the TestContext.AddResultFile
method:
[TestClass]
public class UnitTest
{
[TestCleanup]
public void TestCleanup()
{
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Passed)
TestContext.AddResultFile(testPassedFile);
else
TestContext.AddResultFile(testFailedFile);
}
[TestMethod]
public void TestMethod()
{
}
public TestContext TestContext { get; set; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With