RunVisualStudioTestsusingTestAgent@1及其隨附工作 (Visual Studio Test Agent Deployment) 已被取代。 請改用 Visual Studio 測試工作。 VSTest 工作可以執行單元和功能測試。 使用多代理程式作業設定在一或多個代理程式上執行測試。 使用 Visual Studio 測試平臺工作來執行測試,而不需要代理程式上的 Visual Studio。 VSTest 工作也會帶來新功能,例如自動重新執行失敗的測試。
語法
# Run functional tests v1
# Deprecated: This task and it’s companion task (Visual Studio Test Agent Deployment) are deprecated. Use the 'Visual Studio Test' task instead. The VSTest task can run unit as well as functional tests. Run tests on one or more agents using the multi-agent job setting. Use the 'Visual Studio Test Platform' task to run tests without needing Visual Studio on the agent. VSTest task also brings new capabilities such as automatically rerunning failed tests.
- task: RunVisualStudioTestsusingTestAgent@1
inputs:
# Setup Options
testMachineGroup: # string. Required. Machines.
dropLocation: # string. Required. Test Drop Location.
# Execution Options
testSelection: 'testAssembly' # 'testAssembly' | 'testPlan'. Required. Test Selection. Default: testAssembly.
#testPlan: # string. Required when testSelection = testPlan. Test Plan.
#testSuite: # string. Required when testSelection = testPlan. Test Suite.
#testConfiguration: # string. Required when testSelection = testPlan. Test Configuration.
sourcefilters: '**\*test*.dll' # string. Required when testSelection = testAssembly. Test Assembly. Default: **\*test*.dll.
#testFilterCriteria: # string. Optional. Use when testSelection = testAssembly. Test Filter criteria.
#runSettingsFile: # string. Run Settings File.
#overrideRunParams: # string. Override Test Run Parameters.
#codeCoverageEnabled: false # boolean. Code Coverage Enabled. Default: false.
#customSlicingEnabled: false # boolean. Distribute tests by number of machines. Default: false.
# Reporting Options
#testRunTitle: # string. Test Run Title.
#platform: # string. Platform.
#configuration: # string. Configuration.
#testConfigurations: # string. Test Configurations.
#autMachineGroup: # string. Application Under Test Machines.
輸入
testMachineGroup
-
電腦
string
。 必須的。
計算機 FQDN 或 IP 位址的逗號分隔清單,其中可能包含埠號碼。 最大值為32部機器或32個代理程式。 清單項目可以是:
- Azure 資源群組的名稱。
- 以逗號分隔的電腦名稱清單。 範例:
dbserver.fabrikam.com,dbserver_int.fabrikam.com:5986,192.168.34:5986
- 上一個工作的輸出變數。
dropLocation
-
測試置放位置
string
。 必須的。
指定測試機器上已由 Windows 計算機檔案複製 或 Azure 檔案複製 工作複製測試二進位檔的位置。 測試代理程式機器中的系統階段變數可用來指定置放位置。 範例:c:\tests
和 %systemdrive%\Tests
。
testSelection
-
測試選取範圍
string
。 必須的。 允許的值:testAssembly
(測試元件)、testPlan
(測試計劃)。 預設值:testAssembly
。
指定測試的執行方式:使用測試元件或測試計劃。
testPlan
-
測試計劃
string
。
testSelection = testPlan
時為必要項。
指定已為此組織設定的測試計劃。
testSuite
-
測試套件
string
。
testSelection = testPlan
時為必要項。
從選取的測試計劃指定測試套件。
testConfiguration
-
測試組態
string
。
testSelection = testPlan
時為必要項。
從選取的測試計劃指定測試組態。
sourcefilters
-
測試元件
string
。
testSelection = testAssembly
時為必要項。 預設值:**\*test*.dll
。
指定要執行測試的測試二進位檔。 可使用萬用字元。 例如,針對檔名中包含 **\*test*.dll;
的所有 .dll
檔案,test
。
testFilterCriteria
-
測試篩選準則
string
。 選擇性。
testSelection = testAssembly
時使用 。
會指定測試在測試元件檔案中執行之測試的篩選條件。 與 /TestCaseFilter
中的 [vstest.console.exe
] 選項相同。 範例: Owner=james&Priority=1
.
runSettingsFile
-
執行配置檔
string
。
指定要與測試搭配使用之 runsettings
或 testsettings
檔案的檔案路徑。
overrideRunParams
-
覆寫測試回合參數
string
。
指定 TestRunParameters
檔案之 runsettings
區段中定義的覆寫參數,或 Properties
檔案的 testsettings
區段。 範例: AppURL=$(DeployURL);Port=8080
.
備註
您可以使用 Test Agent 2017 Update 4 或更高版本,透過 testsettings
存取 TestContext
檔案中指定的屬性。
已啟用程式代碼涵蓋範圍 codeCoverageEnabled
-
boolean
。 預設值:false
。
指定是否為工作啟用程式代碼涵蓋範圍。
customSlicingEnabled
-
依計算機數目散發測試
boolean
。 預設值:false
。
當這個布爾值設定為 true
時,測試會根據提供的機器數目而非測試容器數目來散發。
備註
.dll
內的測試也可能分散到多部計算機。
testRunTitle
-
測試回合標題
string
。
指定測試回合的名稱。
platform
-
平臺
string
。
指定應該報告測試的平臺。 如果您已為建置工作中 platform
定義變數,請使用 變數作為值。
configuration
-
組態
string
。
指定應該報告測試的組態。 如果您已為建置工作中 configuration
定義變數,請使用 變數作為值。
testConfigurations
-
測試組態
string
。
選擇性。 將測試案例篩選與測試組態標識碼產生關聯。 語法:<Filter1>:<Id1>;DefaultTestConfiguration:<Id3>
。 範例: FullyQualifiedName~Chrome:12
.
在測試機器下 autMachineGroup
- 應用程式
string
。
執行伺服器進程,例如 W3WP.exe
的計算機、輸出變數或計算機組名的逗號分隔清單。
工作控制選項
除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制項選項和一般工作屬性。
輸出變數
沒有。
需求
要求 | 說明 |
---|---|
管線類型 | YAML、傳統組建、傳統版本 |
執行於 | 代理 |
需求 | 沒有 |
功能 | 此工作不符合作業中後續工作的任何需求。 |
命令限制 | 任意 |
Settable 變數 | 任意 |
代理程式版本 | 1.104.0 或更新 |
工作類別 | 測試 |