Share via


TestToolsTask Task

The TestToolsTask task runs tests for an end-to-end build or for a desktop build. Set a desktop build type by setting the property IsDesktopBuild to true.

Parameters

Property

Description

Condition

Optional String parameter.

Boolean expression that the MSBuild engine uses to determine whether this task will be executed. For information, see MSBuild Conditions.

BuildFlavor

Specifies the build configuration. For example, Debug.

Defined for end-to-end (not desktop) build only.

Platform

Specifies the platform. For example, x86 or Any CPU.

Defined for end-to-end (not desktop) build only.

PublishServer

Specifies the Team Foundation Server URL.

Defined for end-to-end (not desktop) build only.

PublishBuild

Specifies the build number for the build.

Defined for end-to-end (not desktop) build only.

SearchPathRoot

Specifies the search path for test files.

Defined for end-to-end and desktop builds.

PathToResultsFilesRoot

Specifies where test results get uploaded.

Defined for end-to-end and desktop builds.

MetaDataFile

Specifies the test metadata file. This file contains test lists and links to tests. For more information about test lists, see Using Test Lists. Test metadata files have the extension .vsmdi.

Defined for end-to-end and desktop builds.

RunConfigFile

Specifies the test configuration file. These files configure the way tests are run. For more information, see Configuring Test Execution. Test run configuration files have the extension .testrunconfig.

Defined for end-to-end and desktop builds.

TestLists

Specifies the test list that is contained in the test metadata file.

Defined for end-to-end and desktop builds.

TeamProject

Specifies the team project name.

Defined for end-to-end (not desktop) build only.

TestContainers

Specifies the file that contains tests. For example, myTestFile.dll.

Remarks

The Microsoft.TeamFoundation.Build.targets file contains an instance of the TestToolsTask task that Team Foundation Build uses as a default implementation for the RunTestWithConfiguration target.

Microsoft.TeamFoundation.Build.targets file is stored in the <root>:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild folder on the Team Foundation Build computer.

Example

The following XML describes the instances of TestToolsTask in the Microsoft.TeamFoundation.Build.targets file that are used for an end-to-end build.

<!-- MetaDataFile tests for non-desktop builds. -->
        <TestToolsTask
              Condition=" '$(IsDesktopBuild)'!='true' and '%(LocalMetaDataFile.Identity)' != '' "
              BuildFlavor="$(Configuration)"
              Platform="$(Platform)"
              PublishServer="$(TeamFoundationServerUrl)"
              PublishBuild="$(BuildNumber)"
              SearchPathRoot="$(OutDir)"
              PathToResultsFilesRoot="$(TestResultsRoot)"
              MetaDataFile="%(LocalMetaDataFile.Identity)"
              RunConfigFile="$(RunConfigFile)"
              TestLists="%(LocalMetaDataFile.TestList)"
              TeamProject="$(TeamProject)"
              ContinueOnError="true" />

        <!-- TestContainer tests for non-desktop builds. -->
        <TestToolsTask
                Condition=" '$(IsDesktopBuild)'!='true' and '%(LocalTestContainer.Identity)' != '' "
                BuildFlavor="$(Configuration)"
                Platform="$(Platform)"
                PublishServer="$(TeamFoundationServerUrl)"
                PublishBuild="$(BuildNumber)"
                SearchPathRoot="$(OutDir)"
                PathToResultsFilesRoot="$(TestResultsRoot)"
                RunConfigFile="$(RunConfigFile)"
                TestContainers="%(LocalTestContainer.Identity)"
                TeamProject="$(TeamProject)"
                ContinueOnError="true" />

The following XML describes the instances of TestToolsTask in the Microsoft.TeamFoundation.Build.targets file that are used for a desktop build.

<!-- MetaDataFile tests for desktop builds. -->
        <TestToolsTask
              Condition=" '$(IsDesktopBuild)'=='true' and '%(MetaDataFile.Identity)' != '' "
              SearchPathRoot="$(OutDir)"
              PathToResultsFilesRoot="$(TestResultsRoot)"
              MetaDataFile="%(MetaDataFile.Identity)"
              RunConfigFile="$(RunConfigFile)"
              TestLists="%(MetaDataFile.TestList)"
              ContinueOnError="true" />

        <!-- TestContainer tests for desktop builds. -->
        <TestToolsTask
                Condition=" '$(IsDesktopBuild)'=='true' and '%(TestContainer.Identity)' != '' "
                SearchPathRoot="$(OutDir)"
                PathToResultsFilesRoot="$(TestResultsRoot)"
                RunConfigFile="$(RunConfigFile)"
                TestContainers="%(TestContainer.Identity)"
                ContinueOnError="true" />

See Also

Tasks

How to: Configure and Run Scheduled Tests After Building Your Application

Customize Build Numbers

Other Resources

Team Foundation Build Targets, Tasks, and Properties