How to: Publish Test Results

Publishing test results moves them to a database known as an operational store. This lets you share the results with other team members. For more information, see Publishing Test Results.

You can publish test results from the following two environments:

  • Publishing Test Results in Visual Studio

  • Publishing Test Results from a Command Line

Publishing Test Results in Visual Studio

To publish test results by using Visual Studio

  1. Run one or more tests.

  2. In the Team Explorer window, select a project by clicking it.

    Note

    You cannot publish test results unless you have selected a project.

  3. On the Test menu, click Windows and then click Test Results to display the Test Results window.

  4. Click Publish on the Test Results window toolbar.

    The Publish Test Results dialog box is displayed.

  5. Select the check box next to each test run that you want to publish.

  6. Choose a associated build number.

  7. Choose a platform, and a build flavor, such as Retail or Debug.

  8. (Optional) To include code coverage data in the data you publish, choose check Include code coverage data for selected runs.

  9. Click OK.

    The test data for the runs you selected is published to the operational store.

Publishing Test Results from a Command Line

In the first of the following procedures, you are not running tests. You are merely publishing results from a previous test run. Therefore, you include no options that are used to specify which tests to run.

In the second procedure, you are both running tests and publishing their results. Therefore, you must include options for both purposes, that is, running tests and publishing results.

To publish test results from a previous test run

  • Use a command line that includes options that specify how to publish the test run. Options that are required for publishing are /publish, /publishbuild, /teamproject/, /platform, and /flavor.

    Use the /publishresultsfile option to specify the name of the results file to publish. This is a file that has the .trx extension.

    For more information, see Command-Line Options for Publishing Test Results.

    The test data for the runs you selected is published to the operational store.

To publish test results from the current test run

  • Run tests from the command line. For more information, see How to: Run Tests from the Command Line.

    The command you use will contain options that specify the tests to run, such as /test and /testmetadata.

    The command line will also include options that specify how to publish the test run. Options that are required for publishing are /publish, /publishbuild, /teamproject/, /platform, and /flavor. Do not use the /publishresultsfile option.

    For more information, see Command-Line Options for Publishing Test Results.

    The test data for the runs you selected is published to the operational store.

See Also

Tasks

How to: Export Test Results

How to: Import Test Results

How to: Connect to Team Foundation Server

How to: Delete Test Results

Concepts

Publishing Test Results

Moving Test Data into the Data Warehouse

MSTest.exe Command-Line Options

Command-Line Options for Publishing Test Results