Command-Line Options for Publishing Test Results

The following options are used to publish test results when you are using the MSTest.exe command-line utility.

Note

The database for the team project collection resides on a Team Foundation Server computer. This means that you can publish test data only if you have Team Explorer installed and your Visual Studio user session is connected to a Team Foundation Server computer. For information about how to connect to Team Foundation Server, see Connect to and Access Team Projects in Team Foundation Server.

Options Required for Publishing Test Results

When you publish test results from the command line, you can either publish the results of a previously completed test run, or you can run tests and publish the new results that the run produces. For more information, see Saving and Publishing Test Results Using Microsoft Visual Studio.

The following options are required for publishing test results: /publish, /publishbuild, /platform, /flavor, and /teamproject. Use this option only to publish the results of a previous test run: /publishresultsfile.

Note

For information about the MSTest.exe command-line options not specifically used for publishing test results, see MSTest.exe Command-Line Options.

/publish

**/publish:[**server name]

Use the /publish option to publish test data to the database for the team project collection associated with the project's Team Foundation Server.

When you use the /publish option, you must correctly specify the name of the Team Foundation Server. The correct format depends on whether the Team Foundation Server has been registered on the client computer, as described here:

  • If the Team Foundation Server is not registered on the client computer, use the URI that identifies the Team Foundation Server. For example, /publish:http://OurTFSMachine:8080.

  • If the Team Foundation Server computer is registered, you can use a shortened form, namely: /publish:OurTFSMachine.

/publishbuild

/publishbuild:[build id]

To publish test data, you must specify the name of a build that has completed. To find the name of a build, follow these steps:

  1. Open Visual Studio and connect to a Team Foundation Server. For more information, see Connect to and Access Team Projects in Team Foundation Server.

  2. Open Team Explorer.

  3. Open your team project and expand the team project node.

  4. Under the build, double-click All Build Types or a specific build type to see its builds.

    Build names that you can use are in the Name column.

    Note

    You can find information about the /platform and the /flavor by double-clicking the build name.

/flavor

/flavor:[flavor]

This option, input as a string, is mandatory for publishing test results. The values of /flavor and /platform must match a valid combination of values for the completed build identified by the /publishbuild option. When you run the MSTest utility with the options for publishing, it first finishes running tests and then it sets the flavor and platform properties of the test run before publishing the test run results.

Examples of using /flavor: /flavor:debug, /flavor:retail

/platform

/platform:[platform]

This option, input as a string, is mandatory for publishing test results. The values of /flavor and /platform must match a valid combination of values for the completed build identified by the /publishbuild option. When you run the MSTest utility with the options for publishing, it first finishes running tests and then it sets the flavor and platform properties of the test run before publishing the test run results.

Examples of using /platform: /platform:AnyCPU, /platform:x86

/publishresultsfile

/publishresultsfile:[file name]

The name of the results file to be published. This file has the .trx extension. To publish the results of the current run using the default name, omit this option.

/teamproject

/teamproject:[team project name]

Specify the name of the team project to which the build belongs.

See Also

Tasks

How to: Run Automated Tests from the Command Line Using MSTest

Concepts

Running Automated Tests from the Command Line

MSTest.exe Command-Line Options