VSTest@2 - Visual Studio 테스트 v2 작업

이 작업을 사용하여 VSTest(Visual Studio Test) 실행기를 사용하여 단위 및 기능 테스트(Selenium, Appium, 코딩된 UI 테스트 등)를 실행합니다. Visual Studio 테스트 어댑터가 있는 테스트 프레임워크를 실행할 수 있습니다. 예제 프레임워크는 MSTest, xUnit, NUnit, Chutzpah(QUnit, Mocha 및 Jasmine을 사용하는 JavaScript 테스트의 경우) 등입니다. 테스트는 이 작업(버전 2)을 사용하여 여러 에이전트에 배포할 수 있습니다.

Syntax

# Visual Studio Test v2
# Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2).
- task: VSTest@2
  inputs:
  # Test selection
    testSelector: 'testAssemblies' # 'testAssemblies' | 'testPlan' | 'testRun'. Required. Select tests using. Default: testAssemblies.
    testAssemblyVer2: # string. Required when testSelector = testAssemblies. Test files. 
    #testPlan: # string. Required when testSelector = testPlan. Test plan. 
    #testSuite: # string. Required when testSelector = testPlan. Test suite. 
    #testConfiguration: # string. Required when testSelector = testPlan. Test configuration. 
    #tcmTestRun: '$(test.RunId)' # string. Optional. Use when testSelector = testRun. Test Run. Default: $(test.RunId).
    searchFolder: '$(System.DefaultWorkingDirectory)' # string. Required. Search folder. Default: $(System.DefaultWorkingDirectory).
    #resultsFolder: '$(Agent.TempDirectory)\TestResults' # string. Test results folder. Default: $(Agent.TempDirectory)\TestResults.
    #testFiltercriteria: # string. Optional. Use when testSelector = testAssemblies. Test filter criteria. 
    #runOnlyImpactedTests: False # boolean. Optional. Use when testSelector = testAssemblies. Run only impacted tests. Default: False.
    #runAllTestsAfterXBuilds: '50' # string. Optional. Use when testSelector = testAssemblies && runOnlyImpactedTests = true. Number of builds after which all tests should be run. Default: 50.
    #uiTests: false # boolean. Test mix contains UI tests. Default: false.
  # Execution options
    #vstestLocationMethod: 'version' # 'version' | 'location'. Select test platform using. Default: version.
    #vsTestVersion: 'latest' # 'latest' | '17.0' | '16.0' | '15.0' | '14.0' | 'toolsInstaller'. Optional. Use when vstestLocationMethod = version. Test platform version. Default: latest.
    #vstestLocation: # string. Optional. Use when vstestLocationMethod = location. Path to vstest.console.exe. 
    #runSettingsFile: # string. Settings file. 
    #overrideTestrunParameters: # string. Override test run parameters. 
    #pathtoCustomTestAdapters: # string. Path to custom test adapters. 
    #runInParallel: False # boolean. Run tests in parallel on multi-core machines. Default: False.
    #runTestsInIsolation: False # boolean. Run tests in isolation. Default: False.
    #codeCoverageEnabled: False # boolean. Code coverage enabled. Default: False.
    #otherConsoleOptions: # string. Other console options. 
    #diagnosticsEnabled: false # boolean. Collect advanced diagnostics in case of catastrophic failures. Default: false.
    #collectDumpOn: 'onAbortOnly' # 'onAbortOnly' | 'always' | 'never'. Optional. Use when diagnosticsEnabled = true. Collect process dump and attach to test run report. Default: onAbortOnly.
    #rerunFailedTests: False # boolean. Rerun failed tests. Default: False.
    #rerunType: 'basedOnTestFailurePercentage' # 'basedOnTestFailurePercentage' | 'basedOnTestFailureCount'. Optional. Use when rerunFailedTests = true. Do not rerun if test failures exceed specified threshold. Default: basedOnTestFailurePercentage.
    #rerunFailedThreshold: '30' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailurePercentage. % failure. Default: 30.
    #rerunFailedTestCasesMaxLimit: '5' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailureCount. # of failed tests. Default: 5.
    #rerunMaxAttempts: '3' # string. Optional. Use when rerunFailedTests = true. Maximum # of attempts. Default: 3.
  # Advanced execution options
    #distributionBatchType: 'basedOnTestCases' # 'basedOnTestCases' | 'basedOnExecutionTime' | 'basedOnAssembly'. Batch tests. Default: basedOnTestCases.
    #batchingBasedOnAgentsOption: 'autoBatchSize' # 'autoBatchSize' | 'customBatchSize'. Optional. Use when distributionBatchType = basedOnTestCases. Batch options. Default: autoBatchSize.
    #customBatchSizeValue: '10' # string. Required when distributionBatchType = basedOnTestCases && batchingBasedOnAgentsOption = customBatchSize. Number of tests per batch. Default: 10.
    #batchingBasedOnExecutionTimeOption: 'autoBatchSize' # 'autoBatchSize' | 'customTimeBatchSize'. Optional. Use when distributionBatchType = basedOnExecutionTime. Batch options. Default: autoBatchSize.
    #customRunTimePerBatchValue: '60' # string. Required when distributionBatchType = basedOnExecutionTime && batchingBasedOnExecutionTimeOption = customTimeBatchSize. Running time (sec) per batch. Default: 60.
    #dontDistribute: False # boolean. Replicate tests instead of distributing when multiple agents are used in the job. Default: False.
  # Reporting options
    #testRunTitle: # string. Test run title. 
    #platform: # string. Build platform. 
    #configuration: # string. Build configuration. 
    #publishRunAttachments: true # boolean. Upload test attachments. Default: true.
    #failOnMinTestsNotRun: False # boolean. Fail the task if a minimum number of tests are not run. Default: False.
    #minimumExpectedTests: '1' # string. Optional. Use when failOnMinTestsNotRun = true. Minimum # of tests. Default: 1.
# Visual Studio Test v2
# Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2).
- task: VSTest@2
  inputs:
  # Test selection
    testSelector: 'testAssemblies' # 'testAssemblies' | 'testPlan' | 'testRun'. Required. Select tests using. Default: testAssemblies.
    testAssemblyVer2: # string. Required when testSelector = testAssemblies. Test files. 
    #testPlan: # string. Required when testSelector = testPlan. Test plan. 
    #testSuite: # string. Required when testSelector = testPlan. Test suite. 
    #testConfiguration: # string. Required when testSelector = testPlan. Test configuration. 
    #tcmTestRun: '$(test.RunId)' # string. Optional. Use when testSelector = testRun. Test Run. Default: $(test.RunId).
    searchFolder: '$(System.DefaultWorkingDirectory)' # string. Required. Search folder. Default: $(System.DefaultWorkingDirectory).
    #resultsFolder: '$(Agent.TempDirectory)\TestResults' # string. Test results folder. Default: $(Agent.TempDirectory)\TestResults.
    #testFiltercriteria: # string. Optional. Use when testSelector = testAssemblies. Test filter criteria. 
    #runOnlyImpactedTests: False # boolean. Optional. Use when testSelector = testAssemblies. Run only impacted tests. Default: False.
    #runAllTestsAfterXBuilds: '50' # string. Optional. Use when testSelector = testAssemblies && runOnlyImpactedTests = true. Number of builds after which all tests should be run. Default: 50.
    #uiTests: false # boolean. Test mix contains UI tests. Default: false.
  # Execution options
    #vstestLocationMethod: 'version' # 'version' | 'location'. Select test platform using. Default: version.
    #vsTestVersion: 'latest' # 'latest' | '16.0' | '15.0' | '14.0' | 'toolsInstaller'. Optional. Use when vstestLocationMethod = version. Test platform version. Default: latest.
    #vstestLocation: # string. Optional. Use when vstestLocationMethod = location. Path to vstest.console.exe. 
    #runSettingsFile: # string. Settings file. 
    #overrideTestrunParameters: # string. Override test run parameters. 
    #pathtoCustomTestAdapters: # string. Path to custom test adapters. 
    #runInParallel: False # boolean. Run tests in parallel on multi-core machines. Default: False.
    #runTestsInIsolation: False # boolean. Run tests in isolation. Default: False.
    #codeCoverageEnabled: False # boolean. Code coverage enabled. Default: False.
    #otherConsoleOptions: # string. Other console options. 
    #diagnosticsEnabled: false # boolean. Collect advanced diagnostics in case of catastrophic failures. Default: false.
    #collectDumpOn: 'onAbortOnly' # 'onAbortOnly' | 'always' | 'never'. Optional. Use when diagnosticsEnabled = true. Collect process dump and attach to test run report. Default: onAbortOnly.
    #rerunFailedTests: False # boolean. Rerun failed tests. Default: False.
    #rerunType: 'basedOnTestFailurePercentage' # 'basedOnTestFailurePercentage' | 'basedOnTestFailureCount'. Optional. Use when rerunFailedTests = true. Do not rerun if test failures exceed specified threshold. Default: basedOnTestFailurePercentage.
    #rerunFailedThreshold: '30' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailurePercentage. % failure. Default: 30.
    #rerunFailedTestCasesMaxLimit: '5' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailureCount. # of failed tests. Default: 5.
    #rerunMaxAttempts: '3' # string. Optional. Use when rerunFailedTests = true. Maximum # of attempts. Default: 3.
  # Advanced execution options
    #distributionBatchType: 'basedOnTestCases' # 'basedOnTestCases' | 'basedOnExecutionTime' | 'basedOnAssembly'. Batch tests. Default: basedOnTestCases.
    #batchingBasedOnAgentsOption: 'autoBatchSize' # 'autoBatchSize' | 'customBatchSize'. Optional. Use when distributionBatchType = basedOnTestCases. Batch options. Default: autoBatchSize.
    #customBatchSizeValue: '10' # string. Required when distributionBatchType = basedOnTestCases && batchingBasedOnAgentsOption = customBatchSize. Number of tests per batch. Default: 10.
    #batchingBasedOnExecutionTimeOption: 'autoBatchSize' # 'autoBatchSize' | 'customTimeBatchSize'. Optional. Use when distributionBatchType = basedOnExecutionTime. Batch options. Default: autoBatchSize.
    #customRunTimePerBatchValue: '60' # string. Required when distributionBatchType = basedOnExecutionTime && batchingBasedOnExecutionTimeOption = customTimeBatchSize. Running time (sec) per batch. Default: 60.
    #dontDistribute: False # boolean. Replicate tests instead of distributing when multiple agents are used in the job. Default: False.
  # Reporting options
    #testRunTitle: # string. Test run title. 
    #platform: # string. Build platform. 
    #configuration: # string. Build configuration. 
    #publishRunAttachments: true # boolean. Upload test attachments. Default: true.
    #failOnMinTestsNotRun: False # boolean. Fail the task if a minimum number of tests are not run. Default: False.
    #minimumExpectedTests: '1' # string. Optional. Use when failOnMinTestsNotRun = true. Minimum # of tests. Default: 1.
# Visual Studio Test v2
# Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2).
- task: VSTest@2
  inputs:
  # Test selection
    testSelector: 'testAssemblies' # 'testAssemblies' | 'testPlan' | 'testRun'. Required. Select tests using. Default: testAssemblies.
    testAssemblyVer2: # string. Required when testSelector = testAssemblies. Test files. 
    #testPlan: # string. Required when testSelector = testPlan. Test plan. 
    #testSuite: # string. Required when testSelector = testPlan. Test suite. 
    #testConfiguration: # string. Required when testSelector = testPlan. Test configuration. 
    #tcmTestRun: '$(test.RunId)' # string. Optional. Use when testSelector = testRun. Test Run. Default: $(test.RunId).
    searchFolder: '$(System.DefaultWorkingDirectory)' # string. Required. Search folder. Default: $(System.DefaultWorkingDirectory).
    #testFiltercriteria: # string. Optional. Use when testSelector = testAssemblies. Test filter criteria. 
    #runOnlyImpactedTests: False # boolean. Optional. Use when testSelector = testAssemblies. Run only impacted tests. Default: False.
    #runAllTestsAfterXBuilds: '50' # string. Optional. Use when testSelector = testAssemblies && runOnlyImpactedTests = true. Number of builds after which all tests should be run. Default: 50.
    #uiTests: false # boolean. Test mix contains UI tests. Default: false.
  # Execution options
    #vstestLocationMethod: 'version' # 'version' | 'location'. Select test platform using. Default: version.
    #vsTestVersion: 'latest' # 'latest' | '16.0' | '15.0' | '14.0' | 'toolsInstaller'. Optional. Use when vstestLocationMethod = version. Test platform version. Default: latest.
    #vstestLocation: # string. Optional. Use when vstestLocationMethod = location. Path to vstest.console.exe. 
    #runSettingsFile: # string. Settings file. 
    #overrideTestrunParameters: # string. Override test run parameters. 
    #pathtoCustomTestAdapters: # string. Path to custom test adapters. 
    #runInParallel: False # boolean. Run tests in parallel on multi-core machines. Default: False.
    #runTestsInIsolation: False # boolean. Run tests in isolation. Default: False.
    #codeCoverageEnabled: False # boolean. Code coverage enabled. Default: False.
    #otherConsoleOptions: # string. Other console options. 
    #diagnosticsEnabled: false # boolean. Collect advanced diagnostics in case of catastrophic failures. Default: false.
    #collectDumpOn: 'onAbortOnly' # 'onAbortOnly' | 'always' | 'never'. Optional. Use when diagnosticsEnabled = true. Collect process dump and attach to test run report. Default: onAbortOnly.
    #rerunFailedTests: False # boolean. Rerun failed tests. Default: False.
    #rerunType: 'basedOnTestFailurePercentage' # 'basedOnTestFailurePercentage' | 'basedOnTestFailureCount'. Optional. Use when rerunFailedTests = true. Do not rerun if test failures exceed specified threshold. Default: basedOnTestFailurePercentage.
    #rerunFailedThreshold: '30' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailurePercentage. % failure. Default: 30.
    #rerunFailedTestCasesMaxLimit: '5' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailureCount. # of failed tests. Default: 5.
    #rerunMaxAttempts: '3' # string. Optional. Use when rerunFailedTests = true. Maximum # of attempts. Default: 3.
  # Advanced execution options
    #distributionBatchType: 'basedOnTestCases' # 'basedOnTestCases' | 'basedOnExecutionTime' | 'basedOnAssembly'. Batch tests. Default: basedOnTestCases.
    #batchingBasedOnAgentsOption: 'autoBatchSize' # 'autoBatchSize' | 'customBatchSize'. Optional. Use when distributionBatchType = basedOnTestCases. Batch options. Default: autoBatchSize.
    #customBatchSizeValue: '10' # string. Required when distributionBatchType = basedOnTestCases && batchingBasedOnAgentsOption = customBatchSize. Number of tests per batch. Default: 10.
    #batchingBasedOnExecutionTimeOption: 'autoBatchSize' # 'autoBatchSize' | 'customTimeBatchSize'. Optional. Use when distributionBatchType = basedOnExecutionTime. Batch options. Default: autoBatchSize.
    #customRunTimePerBatchValue: '60' # string. Required when distributionBatchType = basedOnExecutionTime && batchingBasedOnExecutionTimeOption = customTimeBatchSize. Running time (sec) per batch. Default: 60.
    #dontDistribute: False # boolean. Replicate tests instead of distributing when multiple agents are used in the job. Default: False.
  # Reporting options
    #testRunTitle: # string. Test run title. 
    #platform: # string. Build platform. 
    #configuration: # string. Build configuration. 
    #publishRunAttachments: true # boolean. Upload test attachments. Default: true.
# Visual Studio Test v2
# Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2).
- task: VSTest@2
  inputs:
  # Test selection
    testSelector: 'testAssemblies' # 'testAssemblies' | 'testPlan' | 'testRun'. Required. Select tests using. Default: testAssemblies.
    testAssemblyVer2: # string. Required when testSelector = testAssemblies. Test files. 
    #testPlan: # string. Required when testSelector = testPlan. Test plan. 
    #testSuite: # string. Required when testSelector = testPlan. Test suite. 
    #testConfiguration: # string. Required when testSelector = testPlan. Test configuration. 
    #tcmTestRun: '$(test.RunId)' # string. Optional. Use when testSelector = testRun. Test Run. Default: $(test.RunId).
    searchFolder: '$(System.DefaultWorkingDirectory)' # string. Required. Search folder. Default: $(System.DefaultWorkingDirectory).
    #testFiltercriteria: # string. Optional. Use when testSelector = testAssemblies. Test filter criteria. 
    #runOnlyImpactedTests: False # boolean. Optional. Use when testSelector = testAssemblies. Run only impacted tests. Default: False.
    #runAllTestsAfterXBuilds: '50' # string. Optional. Use when testSelector = testAssemblies && runOnlyImpactedTests = true. Number of builds after which all tests should be run. Default: 50.
    #uiTests: false # boolean. Test mix contains UI tests. Default: false.
  # Execution options
    #vstestLocationMethod: 'version' # 'version' | 'location'. Select test platform using. Default: version.
    #vsTestVersion: 'latest' # 'latest' | '16.0' | '15.0' | '14.0' | 'toolsInstaller'. Optional. Use when vstestLocationMethod = version. Test platform version. Default: latest.
    #vstestLocation: # string. Optional. Use when vstestLocationMethod = location. Path to vstest.console.exe. 
    #runSettingsFile: # string. Settings file. 
    #overrideTestrunParameters: # string. Override test run parameters. 
    #pathtoCustomTestAdapters: # string. Path to custom test adapters. 
    #runInParallel: False # boolean. Run tests in parallel on multi-core machines. Default: False.
    #runTestsInIsolation: False # boolean. Run tests in isolation. Default: False.
    #codeCoverageEnabled: False # boolean. Code coverage enabled. Default: False.
    #otherConsoleOptions: # string. Other console options. 
    #diagnosticsEnabled: True # boolean. Collect advanced diagnostics in case of catastrophic failures. Default: True.
    #collectDumpOn: 'onAbortOnly' # 'onAbortOnly' | 'always' | 'never'. Optional. Use when diagnosticsEnabled = true. Collect process dump and attach to test run report. Default: onAbortOnly.
    #rerunFailedTests: False # boolean. Rerun failed tests. Default: False.
    #rerunType: 'basedOnTestFailurePercentage' # 'basedOnTestFailurePercentage' | 'basedOnTestFailureCount'. Optional. Use when rerunFailedTests = true. Do not rerun if test failures exceed specified threshold. Default: basedOnTestFailurePercentage.
    #rerunFailedThreshold: '30' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailurePercentage. % failure. Default: 30.
    #rerunFailedTestCasesMaxLimit: '5' # string. Optional. Use when rerunFailedTests = true && rerunType = basedOnTestFailureCount. # of failed tests. Default: 5.
    #rerunMaxAttempts: '3' # string. Optional. Use when rerunFailedTests = true. Maximum # of attempts. Default: 3.
  # Advanced execution options
    #distributionBatchType: 'basedOnTestCases' # 'basedOnTestCases' | 'basedOnExecutionTime' | 'basedOnAssembly'. Batch tests. Default: basedOnTestCases.
    #batchingBasedOnAgentsOption: 'autoBatchSize' # 'autoBatchSize' | 'customBatchSize'. Optional. Use when distributionBatchType = basedOnTestCases. Batch options. Default: autoBatchSize.
    #customBatchSizeValue: '10' # string. Required when distributionBatchType = basedOnTestCases && batchingBasedOnAgentsOption = customBatchSize. Number of tests per batch. Default: 10.
    #batchingBasedOnExecutionTimeOption: 'autoBatchSize' # 'autoBatchSize' | 'customTimeBatchSize'. Optional. Use when distributionBatchType = basedOnExecutionTime. Batch options. Default: autoBatchSize.
    #customRunTimePerBatchValue: '60' # string. Required when distributionBatchType = basedOnExecutionTime && batchingBasedOnExecutionTimeOption = customTimeBatchSize. Running time (sec) per batch. Default: 60.
    #dontDistribute: False # boolean. Do not distribute tests and replicate instead when multiple agents are used in the job. Default: False.
  # Reporting options
    #testRunTitle: # string. Test run title. 
    #platform: # string. Build platform. 
    #configuration: # string. Build configuration. 
    #publishRunAttachments: true # boolean. Upload test attachments. Default: true.

입력

testSelector - 를 사용하여 테스트 선택
string. 필수 요소. 허용되는 값: testAssemblies (테스트 어셈블리), testPlan (테스트 계획), testRun (테스트 실행). 기본값은 testAssemblies입니다.

  • 테스트 어셈블리: 테스트를 포함하는 하나 이상의 테스트 어셈블리를 지정합니다. 필요에 따라 필터 조건을 지정하여 특정 테스트만 선택할 수 있습니다.
  • 테스트 계획: 연결된 자동화된 테스트 방법이 있는 테스트 계획에서 테스트를 실행합니다. 테스트를 테스트 사례 작업 항목과 연결하는 방법에 대한 자세한 내용은 자동화된 테스트를 테스트 사례와 연결을 참조하세요.
  • 테스트 실행:테스트 계획에서 테스트를 실행하도록 환경을 설정할 때 이 옵션을 사용합니다. CI/CD(연속 통합/지속적인 배포) 파이프라인에서 테스트를 실행할 때 이 옵션을 사용하면 안 됩니다.

testAssemblyVer2 - 테스트 파일
string. 필요한 경우 testSelector = testAssemblies입니다. 기본값은 **\bin\**\*test.dll\n**\bin\**\*tests.dll입니다.

지정된 파일에서 테스트를 실행합니다. 순서가 지정된 테스트 및 웹 테스트는 각각 및 .webtest 파일을 지정하여 .orderedtest 실행할 수 있습니다. 를 실행 .webtest하려면 Visual Studio 2017 업데이트 4 이상이 필요합니다. 파일 경로는 검색 폴더를 기준으로 합니다. 이 입력은 여러 줄의 미니매치 패턴을 지원합니다.

# Example
- task: VSTest@2
  inputs:
    testSelector: 'testAssemblies'
    testAssemblyVer2: |
      **\*test*.dll
      !**\*TestAdapter.dll
      !**\obj\**

testAssemblyVer2 - 테스트 파일
string. 필요한 경우 testSelector = testAssemblies입니다. 기본값은 **\*test*.dll\n!**\*TestAdapter.dll\n!**\obj\**입니다.

지정된 파일에서 테스트를 실행합니다. 순서가 지정된 테스트 및 웹 테스트는 각각 및 .webtest 파일을 지정하여 .orderedtest 실행할 수 있습니다. 를 실행 .webtest하려면 Visual Studio 2017 업데이트 4 이상이 필요합니다. 파일 경로는 검색 폴더를 기준으로 합니다. 이 입력은 여러 줄의 미니매치 패턴을 지원합니다.

# Example
- task: VSTest@2
  inputs:
    testSelector: 'testAssemblies'
    testAssemblyVer2: |
      **\*test*.dll
      !**\*TestAdapter.dll
      !**\obj\**

testPlan - 테스트 계획
string. 필요한 경우 testSelector = testPlan입니다.

자동화된 테스트 사례가 있는 테스트 도구 모음을 포함하는 테스트 계획을 지정합니다.


testSuite - 테스트 도구 모음
string. 필요한 경우 testSelector = testPlan입니다.

자동화된 테스트 사례를 포함하는 하나 이상의 테스트 도구 모음을 지정합니다. 테스트 사례 작업 항목은 자동화된 테스트 메서드와 연결되어야 합니다.


testConfiguration - 테스트 구성
string. 필요한 경우 testSelector = testPlan입니다.

테스트 구성을 지정합니다.


tcmTestRun - 테스트 실행
string. 선택 사항입니다. 을 사용할 때 testSelector = testRun사용합니다. 기본값은 $(test.RunId)입니다.

테스트 계획에서 자동화된 테스트 실행을 트리거할 때 사용되는 테스트 실행 기반 선택을 지정 합니다. 이 옵션은 CI/CD 파이프라인에서 테스트를 실행하는 데 사용할 수 없습니다.


searchFolder - Search 폴더
string. 필수 요소. 기본값은 $(System.DefaultWorkingDirectory)입니다.

테스트 어셈블리를 검색할 폴더를 지정합니다.


resultsFolder - 테스트 결과 폴더
string. 기본값은 $(Agent.TempDirectory)\TestResults입니다.

테스트 결과를 저장할 폴더를 지정합니다. 기본 디렉터리를 사용하는 경우 파이프라인 실행이 끝날 때 정리됩니다. 테스트가 실행되기 전에 작업 시작 vstest 시 결과 디렉터리가 항상 정리됩니다. 제공된 경우 상대 폴더 경로는 에 상대적 $(Agent.TempDirectory)인 것으로 간주됩니다.


testFiltercriteria - 테스트 필터 조건
string. 선택 사항입니다. 을 사용할 때 testSelector = testAssemblies사용합니다.

테스트 어셈블리에서 테스트를 필터링하는 추가 조건을 지정합니다. 예: Priority=1|Name=MyTestMethod 명령줄 옵션에 대해 알아봅니다.


runOnlyImpactedTests - 영향을 받은 테스트만 실행
boolean. 선택 사항입니다. 을 사용할 때 testSelector = testAssemblies사용합니다. 기본값은 False입니다.

코드 변경의 유효성을 검사하는 데 필요한 테스트를 자동으로 지정하고 실행합니다. 테스트 영향 분석 사용에 대해 알아봅니다.


runAllTestsAfterXBuilds - 모든 테스트를 실행해야 하는 빌드 수
string. 선택 사항입니다. 을 사용할 때 testSelector = testAssemblies && runOnlyImpactedTests = true사용합니다. 기본값은 50입니다.

모든 테스트가 자동으로 실행되기 전에 실행할 빌드 수를 지정합니다. 테스트 영향 분석은 테스트 사례와 소스 코드 간의 매핑을 저장합니다. 모든 테스트를 정기적으로 실행하여 매핑을 다시 생성하는 것이 좋습니다.


uiTests - 테스트 조합에 UI 테스트 포함
boolean. 기본값은 false입니다.

UI 테스트를 실행하려면 에이전트가 Autologon을 사용하도록 설정된 대화형 모드에서 실행되도록 설정되어 있는지 확인합니다. 빌드/릴리스를 큐에 대기하기 전에 대화형으로 실행되도록 에이전트를 설정해야 합니다. 이 확인란을 선택하면 대화형 모드에서 에이전트가 자동으로 구성되지 않습니다. 이 옵션은 오류를 방지하기 위해 에이전트를 적절하게 구성하는 미리 알림 역할을 합니다. VS 2015 및 2017 풀의 호스트된 Windows 에이전트를 사용하여 UI 테스트를 실행할 수 있습니다.


vstestLocationMethod - 를 사용하여 테스트 플랫폼 선택
string. 허용되는 값: version, location (특정 위치). 기본값은 version입니다.

사용할 테스트 플랫폼을 지정합니다.


vsTestVersion - 테스트 플랫폼 버전
string. 선택 사항입니다. 을 사용할 때 vstestLocationMethod = version사용합니다. 허용되는 값: latest, 17.0 (Visual Studio 2022), 16.0 (Visual Studio 2019), 15.0 (Visual Studio 2017), 14.0 (Visual Studio 2015), toolsInstaller (도구 설치 관리자에 의해 설치됨). 기본값은 latest입니다.

사용할 Visual Studio 테스트 버전을 지정합니다. 최신 을 지정한 경우 이 입력은 설치된 최신 버전(허용되는 값 목록에서)을 선택합니다. 에이전트에서 Visual Studio 없이 테스트를 실행하려면 도구 설치 관리자에 의해 설치 됨 옵션을 사용합니다. NuGet에서 테스트 플랫폼을 획득하려면 Visual Studio 테스트 플랫폼 설치 관리자 작업을 포함해야 합니다.


vsTestVersion - 테스트 플랫폼 버전
string. 선택 사항입니다. 을 사용할 때 vstestLocationMethod = version사용합니다. 허용되는 값: latest, 16.0 (Visual Studio 2019), 15.0 (Visual Studio 2017), 14.0 (Visual Studio 2015), toolsInstaller (도구 설치 관리자에서 설치됨). 기본값은 latest입니다.

사용할 Visual Studio 테스트 버전을 지정합니다. 최신 을 지정한 경우 이 입력은 설치된 최신 버전(허용되는 값 목록에서)을 선택합니다. 에이전트에서 Visual Studio 없이 테스트를 실행하려면 도구 설치 관리자에 의해 설치 됨 옵션을 사용합니다. NuGet에서 테스트 플랫폼을 획득하려면 Visual Studio 테스트 플랫폼 설치 관리자 작업을 포함해야 합니다.


vstestLocation - vstest.console.exe경로
string. 선택 사항입니다. 을 사용할 때 vstestLocationMethod = location사용합니다.

VSTest의 경로를 지정합니다.


runSettingsFile - 설정 파일
string.

테스트에 runsettings 사용할 또는 testsettings 파일의 경로를 지정합니다. Visual Studio 15.7 이상의 경우 모든 테스트 형식에 를 사용합니다 runsettings . 파일을 파일로 .testsettings 변환하는 방법에 대해 자세히 알아봅니다.runsettings.


overrideTestrunParameters - 테스트 실행 매개 변수 재정의
string.

파일의 섹션 또는 파일의 섹션에 TestRunParameters 정의된 매개 변수를 Properties 재정의합니다testsettings.runsettings 예: -key1 value1 -key2 value2 참고: 파일에 지정된 속성은 testsettings Visual Studio 2017(업데이트 4 이상)을 사용하여 에 액세스할 TestContext 수 있습니다.


pathtoCustomTestAdapters - 사용자 지정 테스트 어댑터 경로
string.

사용자 지정 테스트 어댑터의 디렉터리 경로를 지정합니다. 테스트 어셈블리와 동일한 폴더에 있는 어댑터는 자동으로 검색됩니다.


runInParallel - 다중 코어 컴퓨터에서 병렬로 테스트 실행
boolean. 기본값은 False입니다.

true설정하면 테스트가 병렬로 실행되고 컴퓨터의 사용 가능한 코어를 활용합니다. 그러면 파일에 지정된 경우 이 MaxCpuCount 재정의 runsettings 됩니다. 테스트를 병렬로 실행하는 방법에 대해 자세히 알아봅니다.


runTestsInIsolation - 격리된 테스트 실행
boolean. 기본값은 False입니다.

격리 모드에서 테스트를 실행합니다. 이로 인해 vstest.console.exe 테스트 프로세스에서 오류가 줄어들 수 있지만 테스트 실행 속도가 느려질 수 있습니다. 이 옵션은 현재 다중 에이전트 작업 설정으로 실행할 때 사용할 수 없습니다.


codeCoverageEnabled - 코드 검사 사용
boolean. 기본값은 False입니다.

테스트 실행에서 코드 검사 정보를 수집합니다.


otherConsoleOptions - 기타 콘솔 옵션
string.

vstest.console.exe 전달할 수 있는 기타 콘솔 옵션입니다.

이러한 옵션은 지원되지 않으며 에이전트 작업의 다중 에이전트 병렬 설정을 사용하여 테스트를 실행하거나, 테스트 계획 또는 테스트 실행 옵션을 사용하여 테스트를 실행하거나, 사용자 지정 일괄 처리 옵션을 선택할 때 무시됩니다. 대신 설정 파일을 사용하여 옵션을 지정할 수 있습니다.


distributionBatchType - 일괄 처리 테스트
string. 허용되는 값: basedOnTestCases (테스트 및 에이전트 수 기준), basedOnExecutionTime (과거 테스트 실행 시간 기준), basedOnAssembly (테스트 어셈블리 기반) 기본값은 basedOnTestCases입니다.

일괄 처리는 테스트 그룹입니다. 테스트 일괄 처리는 동시에 테스트를 실행하고 일괄 처리에 대한 결과가 게시됩니다. 태스크가 실행되는 작업이 여러 에이전트를 사용하도록 설정된 경우 각 에이전트는 병렬로 실행하기 위해 사용 가능한 테스트 일괄 처리를 선택합니다. 일괄 처리를 실행할 수 있습니다.

테스트 및 에이전트 수에 따라 달라집니다. 테스트 실행에 참여하는 테스트 및 에이전트 수를 기반으로 하는 간단한 일괄 처리입니다.

테스트의 과거 실행 시간을 기반으로 합니다. 이 일괄 처리는 과거 실행 시간을 고려하여 각 일괄 처리의 실행 시간이 거의 동일한 테스트 일괄 처리를 만듭니다.

테스트 어셈블리 기반. 어셈블리의 테스트는 함께 일괄 처리됩니다.


batchingBasedOnAgentsOption - 일괄 처리 옵션
string. 선택 사항입니다. 을 사용할 때 distributionBatchType = basedOnTestCases사용합니다. 허용되는 값: autoBatchSize (일괄 처리 크기를 자동으로 결정), customBatchSize (일괄 처리 크기 지정). 기본값은 autoBatchSize입니다.

테스트 실행에 참여하는 테스트 및 에이전트 수에 따라 간단한 일괄 처리를 지정합니다. 일괄 처리 크기가 자동으로 결정되면 각 일괄 처리에 테스트가 포함됩니다 (total number of tests / number of agents) . 일괄 처리 크기를 지정하면 각 일괄 처리에 지정된 수의 테스트가 포함됩니다.


customBatchSizeValue - 일괄 처리당 테스트 수
string. 필요한 경우 distributionBatchType = basedOnTestCases && batchingBasedOnAgentsOption = customBatchSize입니다. 기본값은 10입니다.

일괄 처리 크기를 지정합니다.


batchingBasedOnExecutionTimeOption - 일괄 처리 옵션
string. 선택 사항입니다. 을 사용할 때 distributionBatchType = basedOnExecutionTime사용합니다. 허용되는 값: autoBatchSize (일괄 처리 시간 자동 결정), customTimeBatchSize (일괄 처리당 실행 시간 지정). 기본값은 autoBatchSize입니다.

이 일괄 처리는 과거 실행 시간을 고려하여 각 일괄 처리의 실행 시간이 거의 동일한 테스트 일괄 처리를 만듭니다. 빠른 실행 테스트는 함께 일괄 처리되지만 장기 실행 테스트는 별도의 일괄 처리에 속할 수 있습니다. 이 옵션을 다중 에이전트 작업 설정과 함께 사용하면 총 테스트 시간이 최소로 줄어듭니다.


customRunTimePerBatchValue - 일괄 처리당 실행 시간(초)
string. 필요한 경우 distributionBatchType = basedOnExecutionTime && batchingBasedOnExecutionTimeOption = customTimeBatchSize입니다. 기본값은 60입니다.

일괄 처리당 실행 시간(초)을 지정합니다.


dontDistribute - 작업에서 여러 에이전트를 사용할 때 배포하는 대신 테스트 복제
boolean. 기본값은 False입니다.

이 옵션을 선택하면 작업이 다중 에이전트 작업에서 실행될 때 에이전트 간에 테스트가 분산되지 않습니다. 선택한 각 테스트는 각 에이전트에서 반복됩니다. 에이전트 작업이 병렬 처리 없이 또는 다중 구성 옵션으로 실행되도록 구성된 경우에는 이 옵션을 적용할 수 없습니다.


dontDistribute - 작업에서 여러 에이전트를 사용하는 경우 테스트를 배포하고 복제하지 마세요.
boolean. 기본값은 False입니다.

이 옵션을 선택하면 작업이 다중 에이전트 작업에서 실행될 때 에이전트 간에 테스트가 분산되지 않습니다. 선택한 각 테스트는 각 에이전트에서 반복됩니다. 에이전트 작업이 병렬 처리 없이 또는 다중 구성 옵션으로 실행되도록 구성된 경우에는 이 옵션을 적용할 수 없습니다.


testRunTitle - 테스트 실행 제목
string.

테스트 실행의 이름을 지정합니다.


platform - 플랫폼 빌드
string.

테스트를 보고할 빌드 플랫폼을 지정합니다. 빌드 작업에서 플랫폼에 대한 변수를 정의한 경우 이 입력과 함께 사용합니다.


configuration - 빌드 구성
string.

테스트를 보고할 빌드 구성을 지정합니다. 빌드 작업에서 구성에 대한 변수를 정의한 경우 이 입력과 함께 사용합니다.


publishRunAttachments - 테스트 첨부 파일 업로드
boolean. 기본값은 true입니다.

실행 수준 첨부 파일 게시를 옵트인하거나 옵트아웃합니다.


failOnMinTestsNotRun - 최소 수의 테스트가 실행되지 않으면 태스크에 실패합니다.
boolean. 기본값은 False입니다.

최소 테스트 수가 실행되지 않으면 작업이 실패합니다. 이는 작업 입력 또는 기본 테스트 어댑터 종속성을 변경하면 원하는 테스트의 하위 집합만 찾을 수 있는 경우에 유용할 수 있습니다.


minimumExpectedTests - 최소 테스트 수
string. 선택 사항입니다. 을 사용할 때 failOnMinTestsNotRun = true사용합니다. 기본값은 1입니다.

태스크가 성공하기 위해 실행할 최소 테스트 수를 지정합니다. 실행된 총 테스트는 통과, 실패 및 중단된 테스트의 합계로 계산됩니다.


diagnosticsEnabled - 치명적인 오류가 발생한 경우 고급 진단 수집
boolean. 기본값은 false입니다.

진단 데이터를 수집하여 테스트 크래시와 같은 치명적인 오류를 해결합니다. 이 옵션을 선택하면 시퀀스 XML 파일이 생성되고 테스트 실행에 연결됩니다. 시퀀스 파일에는 테스트가 실행된 시퀀스에 대한 정보가 포함되어 있으므로 잠재적인 원인 테스트를 식별할 수 있습니다.


diagnosticsEnabled - 치명적인 오류가 발생한 경우 고급 진단 수집
boolean. 기본값은 True입니다.

진단 데이터를 수집하여 테스트 크래시와 같은 치명적인 오류를 해결합니다. 이 옵션을 선택하면 시퀀스 XML 파일이 생성되고 테스트 실행에 연결됩니다. 시퀀스 파일에는 테스트가 실행된 시퀀스에 대한 정보가 포함되어 있으므로 잠재적인 원인 테스트를 식별할 수 있습니다.


collectDumpOn - 프로세스 덤프 수집 및 테스트 실행 보고서에 연결
string. 선택 사항입니다. 을 사용할 때 diagnosticsEnabled = true사용합니다. 허용되는 값: onAbortOnly (중단에만 해당), always, . never 기본값은 onAbortOnly입니다.

추가 분석에 사용할 수 있는 미니 덤프를 수집합니다.

  • onAbortOnly - 테스트 실행이 중단된 경우에만 미니 덤프가 수집됩니다.
  • 항상 - 테스트 실행이 완료되었는지 여부에 관계없이 미니 덤프가 항상 수집됩니다.
  • Never - 테스트 실행이 완료되었는지 여부에 관계없이 미니 덤프가 수집되지 않습니다.

rerunFailedTests - 실패한 테스트 다시 실행
boolean. 기본값은 False입니다.

실패한 테스트는 통과하거나 최대 시도 횟수에 도달할 때까지 다시 실행합니다.


rerunType - 테스트 실패가 지정된 임계값을 초과하는 경우 다시 실행하지 마세요.
string. 선택 사항입니다. 을 사용할 때 rerunFailedTests = true사용합니다. 허용되는 값: basedOnTestFailurePercentage (% 실패), basedOnTestFailureCount (실패한 테스트 수). 기본값은 basedOnTestFailurePercentage입니다.

실패율이 지정된 임계값을 초과할 때 테스트를 다시 실행하지 않도록 합니다. 이는 환경 문제로 인해 대규모 오류가 발생하는 경우에 적용됩니다. 실패 비율 또는 실패한 테스트 수를 임계값으로 지정할 수 있습니다.


rerunFailedThreshold - % 실패
string. 선택 사항입니다. 을 사용할 때 rerunFailedTests = true && rerunType = basedOnTestFailurePercentage사용합니다. 기본값은 30입니다.

실패한 테스트 사례의 백분율이 지정된 임계값을 초과할 때 테스트를 다시 실행하지 않도록 합니다. 이는 환경 문제로 인해 대규모 오류가 발생하는 경우에 적용됩니다.


rerunFailedTestCasesMaxLimit - 실패한 테스트 수
string. 선택 사항입니다. 을 사용할 때 rerunFailedTests = true && rerunType = basedOnTestFailureCount사용합니다. 기본값은 5입니다.

실패한 테스트 사례 수가 지정된 한도를 초과할 때 테스트를 다시 실행하지 않도록 합니다. 이는 환경 문제로 인해 대규모 오류가 발생하는 경우에 적용됩니다.


rerunMaxAttempts - 최대 시도 횟수
string. 선택 사항입니다. 을 사용할 때 rerunFailedTests = true사용합니다. 기본값은 3입니다.

실패한 테스트를 다시 시도해야 하는 최대 횟수를 지정합니다. 최대 시도 횟수에 도달하기 전에 테스트가 통과하면 다시 실행되지 않습니다.


작업 제어 옵션

모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성을 참조하세요.

출력 변수

없음

설명

Visual Studio 테스트 실행기를 사용하여 단위 및 기능 테스트(Selenium, Appium, 코딩된 UI 테스트 등)를 실행하려면 이 작업을 사용합니다. MSTest 기반 테스트와 함께 Visual Studio 테스트 어댑터가 있는 테스트 프레임워크(예: xUnit, NUnit 또는 Chutzpah)도 실행할 수 있습니다.

.runsettings 파일에서 적절한 대상 프레임워크 값을 지정하여 대상 .NET Core 프레임워크를 실행할 수 있음을 테스트합니다.

테스트는 이 작업의 버전 2를 사용하여 여러 에이전트에 배포할 수 있습니다. 자세한 내용은 Visual Studio 테스트 작업을 사용하여 병렬로 테스트 실행을 참조하세요.

필수 구성 요소 확인

Windows 자체 호스팅 에이전트를 사용하는 경우 이 필수 구성 요소를 설치해야 합니다.

요청

에이전트에는 다음과 같은 기능이 있어야 합니다.

vstest

vstest 수요는 다음 두 가지 방법으로 충족할 수 있습니다.

  1. Visual Studio가 에이전트 컴퓨터에 설치됩니다.
  2. 파이프라인 정의에서 Visual Studio 테스트 플랫폼 설치 관리자 작업을 사용합니다.

TestCase를 데이터 원본으로 사용하는 테스트를 실행하려면 어떻게 해야 하나요?

TestCase를 데이터 원본으로 사용하는 자동화된 테스트를 실행하려면 다음이 필요합니다.

  1. 에이전트 컴퓨터에 Visual Studio 2017.6 이상이 있어야 합니다. Visual Studio 테스트 플랫폼 설치 관리자 작업은 TestCase를 데이터 원본으로 사용하는 테스트를 실행하는 데 사용할 수 없습니다.
  2. scope "작업 항목(전체)"에 대한 권한이 부여된 PAT를 만듭니다.
  3. 값이 이전 단계에서 만든 PAT로 설정된 보안 Test.TestCaseAccessToken 빌드 또는 릴리스 변수를 추가합니다.

일부 작업 옵션으로 데이터 기반 xUnit 및 NUnit 테스트를 실행할 때 문제가 발생합니다. 알려진 제한 사항이 있나요?

xUnit 및 NUnit 테스트 프레임워크를 사용하는 데이터 기반 테스트에는 몇 가지 알려진 제한 사항이 있으며 다음 작업 옵션과 함께 사용할 수 없습니다.

  1. 실패한 테스트를 다시 실행합니다.
  2. 여러 에이전트에 테스트를 배포하고 옵션을 일괄 처리합니다.
  3. 테스트 영향 분석.

위의 제한 사항은 이러한 테스트 프레임워크의 어댑터가 데이터 기반 테스트를 검색하고 보고하는 방식 때문입니다.

VSTest 태스크가 한 번에 여러 대상 프레임워크를 대상으로 하는 테스트 실행을 지원하나요?

예, 버전 17.3 VSTest부터는 한 번에 여러 대상 프레임워크를 대상으로 하는 테스트 실행을 지원합니다. 이전에는 VSTest 플랫폼 쪽의 제한으로 인해 이 작업을 수행할 수 없었습니다.

여러 대상 프레임워크에 속하는 테스트를 실행하려면 Visual Studio 테스트 플랫폼 설치 관리자 를 통해 호환되는 버전의 VSTest를 설치하고 사용하도록 를 로 설정 vsTestVersiontoolsInstaller 해야 합니다.

테스트 결과를 게시하는 동안 다음 오류가 발생합니다. 테스트 결과를 게시하지 못했습니다. 잘못된 우선 순위가 지정되었나요?

이 오류는 테스트 메서드 중 우선 순위가 255보다 높게 설정된 경우 코드에서 테스트 메서드 우선 순위를 수정하고 테스트를 다시 실행하는 경우에 발생합니다. 생성된 trx 파일을 검토하여 우선 순위가 255보다 큰 모든 테스트를 확인할 수 있습니다.

요구 사항

요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트, DeploymentGroup
요청 자체 호스팅 에이전트에는 이 작업을 사용하는 작업을 실행하기 위한 다음 요구 사항과 일치하는 기능이 있어야 합니다. vstest
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
설정 가능한 변수 모두
에이전트 버전 2.103.0 이상
작업 범주 테스트