Share via


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 operational store 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 How to: Connect to 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 How to: Publish Test Results.

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 operational store associated with the project's Team Foundation Server. For more information about publishing test results, see How to: Publish Test Results.

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:https://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, perform the following steps:

  1. Open Visual Studio and connect to a Team Foundation Server. For more information, see How to: Connect to 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 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: Publish Test Results
How to: Run Tests from the Command Line

Concepts

MSTest.exe Command-Line Options