In Visual Studio 2010, if you are executing manual tests on a virtual lab environment, then you are provided an option to take snapshot of the environment as mentioned here. These snapshots (or the link to snapshot) gets attached to the manual test case result and/or the bugs (work item) automatically and no explicit gesture is required from you to add the snapshot links to the bug/test case result. However for automated tests you are expected to attach the snapshot link(s) to the result/bug yourself.

In this post, I will share what steps I follow typically to add the snapshot link to the automated test case failure result/bug.

- Identify the test case results for which snapshot need to be linked. So typically I analyze a test run logs, see which test cases passed, which ones failed and which of the failed test cases deserves a bug. For example: – In the following test run, I have identified that test case CodedUITestMethod1 (purple color box) deserves a bug and the environment snapshot needs to be attached to the bug. 

testRunLogs

- Find the snapshot link which should be attached to the bug.

  • Check the name of the environment (the one in red box) on which the test was run.
  • Go to lab center and connect to that environment using Microsoft Environment Viewer.

ConnectToEnvironmentViewer

  • Find whether any existing snapshot will help in analyzing the result/bug. If not, then I take a snapshot otherwise I choose an existing one.
  • Right click on the snapshot which should be linked to the result/bug and then click “share the snapshot”.

shareSnapshot

  • This opens up a save as file dialog similar to the one shown below and I save the snapshot file on the file system.

FileChooserDialog

- Attach the snapshot link to the test case result.

  • View the result of the test case. (black box in the first picture above)
  • Expand the attachment section (blue box in the below picture), add an attachment (red box), choose the snapshot link which should be attached (black box).

attach the snapshot link to the test case result

  • Save the updated test case result and the link to snapshot is attached to the test case result.

linkToSnapshotAttachedToTestCaseResult

- Now I log a bug for the specified test case (green box in the first picture above) and the snapshot link gets linked to the bug.

bugCreated 

Enjoy !!