How to: Publish Test Results
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Publishing test results moves them to a database known as the database for the team project collection. 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
Run one or more tests.
In the Team Explorer window, select a project by clicking it.
Note
You cannot publish test results unless you have selected a project.
On the Test menu, click Windows and then click Test Results to display the Test Results window.
Click Publish on the Test Results window toolbar.
The Publish Test Results dialog box is displayed.
Select the check box next to each test run that you want to publish.
Choose an associated build number.
Choose a platform, and a build flavor, such as Retail or Debug.
(Optional) To include code coverage data in the data you that you publish, choose check Include code coverage data for selected runs.
Click OK.
The test data for the runs you selected is published to the database for the team project collection.
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 database for the team project collection.
To publish test results from the current test run
Run tests from the command line. For more information, see How to: Run Automated Tests from the Command Line Using MSTest.
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 database for the team project collection.
See Also
Tasks
Concepts
Moving Test Data into the Data Warehouse
MSTest.exe Command-Line Options
Command-Line Options for Publishing Test Results