แก้ไข

แชร์ผ่าน


VSTest@1 - Visual Studio Test v1 task

Use this task to run tests with Visual Studio test runner.

This version of the task is deprecated; use VSTest@3.

Use this task to run tests with Visual Studio test runner.

Syntax

# Visual Studio Test v1
# Run tests with Visual Studio test runner.
- task: VSTest@1
  inputs:
  # Execution Options
    testAssembly: '**\*test*.dll;-:**\obj\**' # string. Required. Test Assembly. Default: **\*test*.dll;-:**\obj\**.
    #testFiltercriteria: # string. Test Filter criteria. 
    #runSettingsFile: # string. Run Settings File. 
    #overrideTestrunParameters: # string. Override TestRun Parameters. 
    #codeCoverageEnabled: False # boolean. Code Coverage Enabled. Default: False.
    #runInParallel: false # boolean. Run In Parallel. Default: false.
  # Advanced Execution Options
    #vstestLocationMethod: 'version' # 'version' | 'location'. VSTest. Default: version.
    #vsTestVersion: '14.0' # 'latest' | '14.0' | '12.0'. Optional. Use when vstestLocationMethod = version. VSTest version. Default: 14.0.
    #vstestLocation: # string. Optional. Use when vstestLocationMethod = location. Path to vstest.console.exe. 
    #pathtoCustomTestAdapters: # string. Path to Custom Test Adapters. 
    #otherConsoleOptions: # string. Other console options. 
  # Reporting Options
    #testRunTitle: # string. Test Run Title. 
    #platform: # string. Platform. 
    #configuration: # string. Configuration. 
    #publishRunAttachments: true # boolean. Upload Test Attachments. Default: true.

Inputs

testAssembly - Test Assembly
string. Required. Default value: **\*test*.dll;-:**\obj\**.

Specifies which test binaries to run tests on. Wildcards can be used. For example, using **\*test*.dll;-:**\obj\** for all DLLs with "test" in the name and excluding files in any subdirectory named "obj".


testFiltercriteria - Test Filter criteria
string.

Specifies additional criteria to filter tests from test assemblies. For example: Priority=1|Name=MyTestMethod.


runSettingsFile - Run Settings File
string.

Specifies the path to the runsettings file to use with the tests. Use $(Build.SourcesDirectory) to access the Project folder.


overrideTestrunParameters - Override TestRun Parameters
string.

Override parameters defined in the TestRunParameters section of the runsettings file. For example: AppURL=$(DeployURL);Port=8080.


codeCoverageEnabled - Code Coverage Enabled
boolean. Default value: False.

Collects code coverage information from the test run.


runInParallel - Run In Parallel
boolean. Default value: false.

Enables a parallel execution of your tests.


vstestLocationMethod - VSTest
string. Allowed values: version, location (Specify Location). Default value: version.


vsTestVersion - VSTest version
string. Optional. Use when vstestLocationMethod = version. Allowed values: latest, 14.0 (Visual Studio 2015), 12.0 (Visual Studio 2013). Default value: 14.0.

Specifies the version of Visual Studio Test to use.


vstestLocation - Path to vstest.console.exe
string. Optional. Use when vstestLocationMethod = location.

Specifies the path to VSTest.


pathtoCustomTestAdapters - Path to Custom Test Adapters
string.

Specifies the directory path to the custom test adapters. NuGet restored adapters are automatically searched for.


otherConsoleOptions - Other console options
string.

Specifies other Console options that can be passed to vstest.console.exe.


testRunTitle - Test Run Title
string.

Specifies a name for the test run.


platform - Platform
string.

Specifies the platform against which the tests should be reported. If you have defined a variable for the platform in your build task, use that when providing this input.


configuration - Configuration
string.

Specifies the configuration against which the tests should be reported. If you have defined a variable for configuration in your build task, use that when providing this input.


publishRunAttachments - Upload Test Attachments
boolean. Default value: true.

Opts in or out of publishing test run level attachments.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: vstest
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.89.0 or greater
Task category Test