共用方式為


TestToolsTask 工作

更新:2007 年 11 月

TestToolsTask 工作會針對端對端組建或桌面組建執行測試。您可以透過將 IsDesktopBuild 屬性設定為 true,設定桌面組建類型。

參數

屬性

描述

Condition

選擇性的 String 參數。

MSBuild 引擎用來決定是否要執行此工作的 Boolean 運算式。如需詳細資訊,請參閱 MSBuild 條件

BuildFlavor

指定組建組態。例如,[偵錯]。

僅針對端對端 (非桌面) 組建定義。

Platform

指定平台。例如,[x86] 或 [任何 CPU]。

僅針對端對端 (非桌面) 組建定義。

PublishServer

指定 Team Foundation Server URL。

僅針對端對端 (非桌面) 組建定義。

PublishBuild

指定組建的組建編號。

僅針對端對端 (非桌面) 組建定義。

SearchPathRoot

指定測試檔案的搜尋路徑。

針對端對端組建和桌面組建定義。

PathToResultsFilesRoot

指定測試結果上載的位置。

針對端對端組建和桌面組建定義。

MetaDataFile

指定測試中繼資料檔案。這個檔案包含測試清單和測試的連結。如需測試清單的詳細資訊,請參閱使用測試清單。測試中繼資料檔案會具有 .vsmdi 的副檔名。

針對端對端組建和桌面組建定義。

RunConfigFile

指定測試組態檔案。這些檔案會設定執行測試的方式。如需詳細資訊,請參閱設定測試執行方式。測試回合組態檔案會具有 .testrunconfig 的副檔名。

針對端對端組建和桌面組建定義。

TestLists

指定測試中繼資料檔案中包含的測試清單。

針對端對端組建和桌面組建定義。

TeamProject

指定 Team 專案名稱。

僅針對端對端 (非桌面) 組建定義。

TestContainers

指定包含測試的檔案。例如,myTestFile.dll。

備註

Microsoft.TeamFoundation.Build.targets 檔包含 TestToolsTask 工作的執行個體 (Instance),而且 Team Foundation Build 會將它當做 RunTestWithConfiguration 目標的預設實作 (Implementation) 使用。

Microsoft.TeamFoundation.Build.targets 檔儲存於 Team Foundation Build 電腦的 <root>:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild 資料夾中。

範例

下列 XML 會描述端對端組建所用之 Microsoft.TeamFoundation.Build.targets 檔中的 TestToolsTask 執行個體 (Instance)。

<!-- 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" />

下列 XML 會描述桌面組建所用之 Microsoft.TeamFoundation.Build.targets 檔中的 TestToolsTask 執行個體。

<!-- 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" />

請參閱

工作

HOW TO:設定和執行建置驗證測試 (BVT)

HOW TO:自訂組建事件

HOW TO:透過組建定義設定測試

概念

Team Foundation Build 工作

其他資源

自訂 Team Foundation Build

Team Foundation Build 目標、工作和屬性