RunVisualStudioTestsusingTestAgent@1 - 运行功能测试 v1 任务

RunVisualStudioTestsusingTestAgent@1及其 (Visual Studio 测试代理部署) 的配套任务已弃用。 请改用 Visual Studio 测试任务。 VSTest 任务可以运行单元测试以及功能测试。 使用多代理作业设置在一个或多个代理上运行测试。 使用 Visual Studio Test Platform 任务运行测试,而无需在代理上使用 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.
# 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;对于文件名中包含的所有.dlltest文件。


testFilterCriteria - 测试筛选器条件
string. 可选。 在 时 testSelection = testAssembly使用 。

指定测试程序集文件中要执行的测试的筛选器。 的工作方式与 中的 vstest.console.exe选项相同/TestCaseFilter。 示例:Owner=james&Priority=1


runSettingsFile - 运行设置文件
string.

指定要用于测试的 runsettingstestsettings 文件的文件路径。


overrideRunParams - 替代测试运行参数
string.

指定在文件的 节或Properties文件的 节testsettingsrunsettingsTestRunParameters定义的替代参数。 示例:AppURL=$(DeployURL);Port=8080

注意

可以使用 Test Agent 2017 Update 4 或更高版本访问TestContext文件中指定的testsettings属性。


codeCoverageEnabled - 已启用代码覆盖率
boolean. 默认值:false

指定是否为任务启用代码覆盖率。


customSlicingEnabled - 按计算机数分布测试
boolean. 默认值:false

当此布尔值的值设置为 true时,将根据提供的计算机数而不是测试容器数来分发测试。

注意

中的 .dll 测试也可能分发到多台计算机。


testRunTitle - 测试运行标题
string.

指定测试运行的名称。


platform - 平台
string.

指定应针对其报告测试的平台。 如果在生成任务中为 platform 定义了变量,请使用 变量作为值。


configuration - 配置
string.

指定应针对其报告测试的配置。 如果在生成任务中为 configuration 定义了变量,请使用 变量作为值。


testConfigurations - 测试配置
string.

可选。 将测试用例筛选器与测试配置 ID 相关联。 语法: <Filter1>:<Id1>;DefaultTestConfiguration:<Id3>。 示例:FullyQualifiedName~Chrome:12


autMachineGroup - 受测应用程序计算机
string.

运行服务器进程(如 W3WP.exe)的计算机、输出变量或计算机组名称的逗号分隔列表。


任务控制选项

除了任务输入,所有任务都有控制选项。 有关详细信息,请参阅 控制选项和常见任务属性

输出变量

无。

要求

要求 说明
管道类型 YAML,经典内部版本,经典版本
运行平台 Agent
需求
功能 此任务不满足作业中后续任务的任何要求。
命令限制 任意
可设置变量 Any
代理版本 1.104.0 或更高版本
任务类别 测试