We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

How to: Attach a File while Running a Test

While you run a test using Test Runner, you have the option to attach files to the test, such as requirements for the application or log files that the application generates. The files can be attached to a test step.

The files can be useful as supporting material related to bugs to help isolate code defects. For more information, see How to: Submit a Bug using Test Runner.


  • Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional

Attaching a document in Test Runner

To attach a document to a test using the Microsoft Test Runner

  1. Choose Add attachment to step result on the toolbar.

  2. Browse to the file that you want to attach and choose Open.

    The document is attached to the test.

Precautions should be taken when attaching and viewing potentially unsafe attachments such as .bat, .exe, .vbs, and .js files because they might contain viruses.