1

I want to attach an HTML document to any test case that is about to fail. I can do this if I use Gallio test runner, but it doesn't integrate well with Visual Studio or TFS.

According to Microsoft's documentation I can attach files to a manual test case, but they have nothing for automated tests.

4 Answers 4

1

Microsoft Test Manager (MTM) supports attachments and it is integrated with Team Foundation Server (TFS). While you executing the test cases you can add screenshots or files to the failed steps.

0

Here's a snippet of code you can use to do what you want: http://vivekbansod.blogspot.com/2013/06/add-attachment-to-test-case-result.html

2
  • I'm guessing this requires a connection to the TFS so it wouldn't work with a local test. I will have to wait for our build team to finish setting up the CI environment before I can try this. Commented Oct 11, 2014 at 0:15
  • Practically anything you do with the MS testing framework is going to need a connection to the TFS server. In the interim you can set your tests to email you the HTML, and manually attach the files to the test cases, but you don't want to be doing that for any length of time.
    – Kate Paulk
    Commented Oct 13, 2014 at 11:00
0

I'm assuming you're using MSTest, and if that's the case you can use TestContext.AddResultFile() (MSDN Documentation). This won't attach files to the test case work item though, it'll only attach files to the test execution result.

0

Highly recommend to look at Allure Test Report framework,
it allows attaching screenshots & files (during execution & on failure, as you need).

Few useful links, as follows:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.