VSTest@2 - Visual Studio Test v2 görevi

Visual Studio Test (VSTest) çalıştırıcısını kullanarak birim ve işlev testlerini (Selenium, Appium, Kodlanmış UI testi vb.) çalıştırmak için bu görevi kullanın. Visual Studio test bağdaştırıcısına sahip test çerçeveleri çalıştırabilirsiniz. Örnek çerçeveler MSTest, xUnit, NUnit, Chutzpah (QUnit, Mocha ve Jasmine kullanan JavaScript testleri için) vb. Testler bu görev (sürüm 2) kullanılarak birden çok aracıya dağıtılabilir.

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.

Girişler

testSelector - Kullanarak testleri seçme
string. Gereklidir. İzin verilen değerler: testAssemblies (Test derlemeleri), testPlan (Test planı), testRun (Test çalıştırması). Varsayılan değer: testAssemblies.

  • Test derlemesi: Testlerinizi içeren bir veya daha fazla test derlemesini belirtir. İsteğe bağlı olarak, yalnızca belirli testleri seçmek için bir filtre ölçütü belirtebilirsiniz.
  • Test planı: Test planınızdan, onunla ilişkilendirilmiş otomatik bir test yöntemi olan testleri çalıştırır. Testleri test çalışması iş öğesiyle ilişkilendirme hakkında daha fazla bilgi edinmek için bkz. Otomatikleştirilmiş testleri test çalışmalarıyla ilişkilendirme.
  • Test çalıştırması:Test planlarından testleri çalıştırmak için bir ortam ayarlarken bu seçeneği kullanın. Bu seçenek, testleri sürekli tümleştirme/sürekli dağıtım (CI/CD) işlem hattında çalıştırırken kullanılmamalıdır.

testAssemblyVer2 - Test dosyaları
string. olduğunda testSelector = testAssembliesgereklidir. Varsayılan değer: **\bin\**\*test.dll\n**\bin\**\*tests.dll.

Belirtilen dosyalardan testleri çalıştırır. Sıralı testler ve web testleri sırasıyla ve .webtest dosyaları belirtilerek .orderedtest çalıştırılabilir. uygulamasını çalıştırmak .webtestiçin Visual Studio 2017 Güncelleştirme 4 veya üzeri gereklidir. Dosya yolları arama klasörüne göredir. Bu giriş, birden çok minimatch deseni çizgisini destekler.

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

testAssemblyVer2 - Test dosyaları
string. olduğunda testSelector = testAssembliesgereklidir. Varsayılan değer: **\*test*.dll\n!**\*TestAdapter.dll\n!**\obj\**.

Belirtilen dosyalardan testleri çalıştırır. Sıralı testler ve web testleri sırasıyla ve .webtest dosyaları belirtilerek .orderedtest çalıştırılabilir. uygulamasını çalıştırmak .webtestiçin Visual Studio 2017 Güncelleştirme 4 veya üzeri gereklidir. Dosya yolları arama klasörüne göredir. Bu giriş, birden çok minimatch deseni çizgisini destekler.

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

testPlan - Test planı
string. olduğunda testSelector = testPlangereklidir.

Otomatik test çalışmalarına sahip test paketlerini içeren bir test planı belirtir.


testSuite - Test paketi
string. olduğunda testSelector = testPlangereklidir.

Otomatik test çalışmalarını içeren bir veya daha fazla test paketi belirtir. Test çalışması iş öğeleri otomatik test yöntemiyle ilişkilendirilmelidir.


testConfiguration - Test yapılandırması
string. olduğunda testSelector = testPlangereklidir.

Test yapılandırmasını belirtir.


tcmTestRun - Test Çalıştırması
string. İsteğe bağlı. olduğunda testSelector = testRunkullanın. Varsayılan değer: $(test.RunId).

Test planlarından otomatik test çalıştırmalarını tetiklerken kullanılan test çalıştırması tabanlı seçimi belirtir. Bu seçenek, CI/CD işlem hattında testleri çalıştırmak için kullanılamaz.


searchFolder - Arama klasörü
string. Gereklidir. Varsayılan değer: $(System.DefaultWorkingDirectory).

Test derlemeleri için aranacak klasörü belirtir.


resultsFolder - Test sonuçları klasörü
string. Varsayılan değer: $(Agent.TempDirectory)\TestResults.

Test sonuçlarını depolamak için klasörü belirtir. Varsayılan dizin kullanılırken işlem hattı çalıştırmasının sonunda temizlenir. Sonuçlar dizini, testler çalıştırılmadan önce görevin başlangıcında vstest her zaman temizlenir. Sağlanırsa göreli klasör yolu ile ilgili $(Agent.TempDirectory)olarak kabul edilir.


testFiltercriteria - Filtre ölçütlerini test etme
string. İsteğe bağlı. olduğunda testSelector = testAssemblieskullanın.

Test derlemelerinden testleri filtrelemek için ek ölçütler belirtir. Örneğin: Priority=1|Name=MyTestMethod. Komut satırı seçenekleri hakkında bilgi edinin.


runOnlyImpactedTests - Yalnızca etkilenen testleri çalıştırma
boolean. İsteğe bağlı. olduğunda testSelector = testAssemblieskullanın. Varsayılan değer: False.

Kod değişikliğini doğrulamak için gereken testleri otomatik olarak belirtir ve çalıştırır. Test Etkisi Analizi'nin kullanımı hakkında bilgi edinin.


runAllTestsAfterXBuilds - Tüm testlerin çalıştırılması gereken derleme sayısı
string. İsteğe bağlı. olduğunda testSelector = testAssemblies && runOnlyImpactedTests = truekullanın. Varsayılan değer: 50.

Tüm testler otomatik olarak çalıştırılmadan önce yürütülecek derleme sayısını belirtir. Test Etkisi Analizi, test çalışmaları ile kaynak kod arasındaki eşlemeyi depolar. Tüm testleri düzenli olarak çalıştırarak eşlemeyi yeniden oluşturmanızı öneririz.


uiTests - Test karışımı ui testleri içeriyor
boolean. Varsayılan değer: false.

UI testlerini çalıştırmak için aracının Autologon etkinken etkileşimli modda çalışacak şekilde ayarlandığından emin olun. Derlemeyi/sürümü kuyruğa almadan önce etkileşimli olarak çalışacak bir aracı ayarlama işlemi yapılmalıdır. Bu kutu işaretlenmesi aracıyı otomatik olarak etkileşimli modda yapılandırmaz. Bu seçenek, hataları önlemek için aracıyı uygun şekilde yapılandırmaya yönelik bir anımsatıcı görevi görür. UI testlerini çalıştırmak için VS 2015 ve 2017 havuzlarından barındırılan Windows aracıları kullanılabilir.


vstestLocationMethod - Kullanarak test platformu seçme
string. İzin verilen değerler: version, location (Belirli konum). Varsayılan değer: version.

Hangi test platformlarının kullanılacağını belirtir.


vsTestVersion - Platform sürümünü test etme
string. İsteğe bağlı. olduğunda vstestLocationMethod = versionkullanın. İzin verilen değerler: latest, 17.0 (Visual Studio 2022), 16.0 (Visual Studio 2019), 15.0 (Visual Studio 2017), 14.0 (Visual Studio 2015), toolsInstaller (Araçlar Yükleyicisi tarafından yüklenir). Varsayılan değer: latest.

Kullanılacak Visual Studio Test sürümünü belirtir. En son belirtilirse, bu giriş yüklenen en son sürümü (izin verilen değerler listesinden) seçer. Aracıda Visual Studio'ya gerek kalmadan testleri çalıştırmak için Araçlar tarafından yüklenen yükleyici seçeneğini kullanın. NuGet'ten test platformunu almak için Visual Studio Test Platformu Yükleyicisi görevini eklediğinizden emin olun.


vsTestVersion - Platform sürümünü test etme
string. İsteğe bağlı. olduğunda vstestLocationMethod = versionkullanın. İzin verilen değerler: latest, 16.0 (Visual Studio 2019), 15.0 (Visual Studio 2017), 14.0 (Visual Studio 2015), toolsInstaller (Araçlar Yükleyicisi tarafından yüklenir). Varsayılan değer: latest.

Kullanılacak Visual Studio Test sürümünü belirtir. En son belirtilirse, bu giriş yüklenen en son sürümü (izin verilen değerler listesinden) seçer. Aracıda Visual Studio'ya gerek kalmadan testleri çalıştırmak için Araçlar tarafından yüklenen yükleyici seçeneğini kullanın. NuGet'ten test platformunu almak için Visual Studio Test Platformu Yükleyicisi görevini eklediğinizden emin olun.


vstestLocation - vstest.console.exeyolu
string. İsteğe bağlı. olduğunda vstestLocationMethod = locationkullanın.

VSTest yolunu belirtir.


runSettingsFile - Ayarlar dosyası
string.

Testlerle kullanılacak veya testsettings dosyasının yolunu runsettings belirtir. Visual Studio 15.7 ve üzeri için tüm test türleri için kullanın runsettings . Bir .testsettings dosyayı dosyaya .runsettings dönüştürme hakkında daha fazla bilgi edinin.


overrideTestrunParameters - Test çalıştırması parametrelerini geçersiz kılma
string.

Bir dosyanın bölümünde veya Properties bir runsettings dosyanın bölümünde testsettings tanımlanan TestRunParameters parametreleri geçersiz kılar. Örneğin: -key1 value1 -key2 value2. Not: Bir testsettings dosyada belirtilen özelliklere Visual Studio 2017 (güncelleştirme 4 veya üzeri) kullanılarak erişilebilir TestContext .


pathtoCustomTestAdapters - Özel test bağdaştırıcılarının yolu
string.

Özel test bağdaştırıcılarının dizin yolunu belirtir. Test derlemeleriyle aynı klasörde bulunan bağdaştırıcılar otomatik olarak bulunur.


runInParallel - Çok çekirdekli makinelerde testleri paralel olarak çalıştırma
boolean. Varsayılan değer: False.

olarak ayarlanırsa truetestler paralel olarak çalıştırılır ve makinenin kullanılabilir çekirdeklerinden yararlanılır. Bu, dosyanızda runsettings belirtilirse öğesini MaxCpuCount geçersiz kılar. Testleri paralel olarak çalıştırma hakkında daha fazla bilgi edinin.


runTestsInIsolation - Testleri yalıtarak çalıştırma
boolean. Varsayılan değer: False.

Testleri yalıtılmış bir işlemde çalıştırır. Bu büyük olasılıkla vstest.console.exe test işleminde daha az hataya yol açar, ancak testler daha yavaş çalışabilir. Bu seçenek şu anda çok aracılı iş ayarıyla çalışırken kullanılamaz.


codeCoverageEnabled - Kod kapsamı etkin
boolean. Varsayılan değer: False.

Test çalıştırmasından kod kapsamı bilgilerini toplar.


otherConsoleOptions - Diğer konsol seçenekleri
string.

vstest.console.exe geçirilebilen diğer konsol seçenekleri.

Bu seçenekler desteklenmez ve bir aracı işinin Çok aracılı paralel ayarı kullanılarak testler çalıştırılırken, Test planı veya Test çalıştırması seçeneği kullanılarak testler çalıştırılırken veya özel bir toplu iş seçeneği belirlendiğinde yoksayılır. Seçenekler bunun yerine bir ayarlar dosyası kullanılarak belirtilebilir.


distributionBatchType - Toplu testler
string. İzin verilen değerler: basedOnTestCases (Test ve aracı sayısına göre), basedOnExecutionTime (Testlerin geçmiş çalışma süresine göre) basedOnAssembly (Test derlemelerine göre). Varsayılan değer: basedOnTestCases.

Toplu iş, bir test grubudur. Bir grup test, testlerini aynı anda çalıştırır ve toplu iş için sonuçlar yayımlanır. Görevin çalıştırıldığı iş birden çok aracı kullanacak şekilde ayarlandıysa, her aracı paralel olarak çalıştırılacak tüm kullanılabilir test toplu işlemlerini alır. Toplu iş çalıştırılabilir:

test ve aracı sayısına göre. Test çalıştırmasına katılan test ve aracı sayısına göre basit toplu işlem.

testlerin geçmiş çalışma süresine bağlı olarak. Bu toplu işlem, her toplu işlemi yaklaşık olarak eşit çalışma süresine sahip olan test toplu işlemlerini oluşturmak için geçmiş çalışma süresini dikkate alır.

test derlemelerini temel alır. Bir derlemeden gelen testler birlikte toplu olarak oluşturulur.


batchingBasedOnAgentsOption - Toplu iş seçenekleri
string. İsteğe bağlı. olduğunda distributionBatchType = basedOnTestCaseskullanın. İzin verilen değerler: autoBatchSize (Toplu iş boyutunu otomatik olarak belirleyin), customBatchSize (Toplu iş boyutu belirtin). Varsayılan değer: autoBatchSize.

Test çalıştırmasına katılan test ve aracı sayısına göre basit toplu işlemi belirtir. Toplu iş boyutu otomatik olarak belirlendiğinde, her toplu işlem testler içerir (total number of tests / number of agents) . Bir toplu iş boyutu belirtilirse, her toplu işlem belirtilen sayıda test içerir.


customBatchSizeValue - Toplu iş başına test sayısı
string. olduğunda distributionBatchType = basedOnTestCases && batchingBasedOnAgentsOption = customBatchSizegereklidir. Varsayılan değer: 10.

Toplu iş boyutunu belirtir.


batchingBasedOnExecutionTimeOption - Toplu iş seçenekleri
string. İsteğe bağlı. olduğunda distributionBatchType = basedOnExecutionTimekullanın. İzin verilen değerler: autoBatchSize (Toplu iş süresini otomatik olarak belirleyin), customTimeBatchSize (Toplu iş başına çalışma süresini belirtin). Varsayılan değer: autoBatchSize.

Bu toplu işlem, her toplu iş yaklaşık olarak eşit çalışma süresine sahip olan test toplu işlemlerini oluşturmak için geçmiş çalışma sürelerini dikkate alır. Hızlı çalışan testler birlikte işlenirken, uzun süre çalışan testler ayrı bir toplu iş grubuna ait olabilir. Bu seçenek çok aracılı iş ayarıyla kullanıldığında toplam test süresi en aza indirilir.


customRunTimePerBatchValue - Toplu iş başına çalışma süresi (sn)
string. olduğunda distributionBatchType = basedOnExecutionTime && batchingBasedOnExecutionTimeOption = customTimeBatchSizegereklidir. Varsayılan değer: 60.

Toplu iş başına çalışma süresini (saniye cinsinden) belirtir.


dontDistribute - İşte birden çok aracı kullanıldığında dağıtmak yerine testleri çoğaltma
boolean. Varsayılan değer: False.

Bu seçeneğin seçilmesi, görev çok aracılı bir işte çalışırken testleri aracılar arasında dağıtmaz. Seçilen testlerin her biri her aracıda yinelenir. Aracı işi paralellik olmadan veya çoklu yapılandırma seçeneğiyle çalışacak şekilde yapılandırıldığında bu seçenek geçerli değildir.


dontDistribute - İşte birden çok aracı kullanıldığında testleri dağıtmayın ve çoğaltmayın
boolean. Varsayılan değer: False.

Bu seçeneğin seçilmesi, görev çok aracılı bir işte çalışırken testleri aracılar arasında dağıtmaz. Seçilen testlerin her biri her aracıda yinelenir. Aracı işi paralellik olmadan veya çoklu yapılandırma seçeneğiyle çalışacak şekilde yapılandırıldığında bu seçenek geçerli değildir.


testRunTitle - Test çalıştırması başlığı
string.

Test çalıştırması için bir ad belirtir.


platform - Platform oluşturma
string.

Testlerin raporlanması gereken derleme platformunu belirtir. Derleme görevinizde platform için bir değişken tanımladıysanız, bunu bu girişle kullanın.


configuration - Derleme yapılandırması
string.

Testlerin raporlanması gereken derleme yapılandırmasını belirtir. Derleme görevinizde yapılandırma için bir değişken tanımladıysanız, bunu bu girişle kullanın.


publishRunAttachments - Test eklerini karşıya yükleme
boolean. Varsayılan değer: true.

Çalıştırma düzeyi eklerini yayımlamayı kabul eder veya devre dışı bırakabilirsiniz.


failOnMinTestsNotRun - En az sayıda test çalıştırılmazsa görev başarısız olur.
boolean. Varsayılan değer: False.

En az sayıda test çalıştırılmazsa görev başarısız olur. Görev girişlerinde veya temel test bağdaştırıcısı bağımlılıklarında yapılan değişiklikler istenen testlerin yalnızca bir alt kümesine yol açıyorsa, bu yararlı olabilir.


minimumExpectedTests - En az test sayısı
string. İsteğe bağlı. when failOnMinTestsNotRun = truekullanın. Varsayılan değer: 1.

Görevin başarılı olması için çalıştırılacak en az test sayısını belirtir. Yürütülen toplam test sayısı, başarılı, başarısız ve durdurulan testlerin toplamı olarak hesaplanır.


diagnosticsEnabled - Yıkıcı hatalarda gelişmiş tanılamaları toplama
boolean. Varsayılan değer: false.

Test kilitlenmesi gibi yıkıcı hataları gidermek için tanılama verilerini toplar. Bu seçenek işaretlendiğinde, bir sıralı XML dosyası oluşturulur ve test çalıştırmasına eklenir. Sıra dosyası, testlerin çalıştırıldığı sıra hakkında bilgi içerir, böylece olası bir suçlu testi tanımlanabilir.


diagnosticsEnabled - Yıkıcı hatalarda gelişmiş tanılamaları toplama
boolean. Varsayılan değer: True.

Test kilitlenmesi gibi yıkıcı hataları gidermek için tanılama verilerini toplar. Bu seçenek işaretlendiğinde, bir sıralı XML dosyası oluşturulur ve test çalıştırmasına eklenir. Sıra dosyası, testlerin çalıştırıldığı sıra hakkında bilgi içerir, böylece olası bir suçlu testi tanımlanabilir.


collectDumpOn - İşlem dökümünü toplama ve test çalıştırması raporuna ekleme
string. İsteğe bağlı. when diagnosticsEnabled = truekullanın. İzin verilen değerler: onAbortOnly (Yalnızca durdurulduysa), always, never. Varsayılan değer: onAbortOnly.

Daha fazla analiz için kullanılabilecek bir mini döküm toplar.

  • onAbortOnly - Mini döküm yalnızca test çalıştırması durdurulduğunda toplanır.
  • Her zaman - Test çalıştırmasının tamamlanıp tamamlanmadığına bakılmaksızın her zaman bir mini döküm toplanır.
  • Hiçbir zaman - test çalıştırmasının tamamlanıp tamamlanmadığına bakılmaksızın mini döküm toplanmaz.

rerunFailedTests - Başarısız testleri yeniden çalıştırma
boolean. Varsayılan değer: False.

Başarısız testleri geçene kadar veya deneme sayısı üst sınırına ulaşılana kadar yeniden çalıştırır.


rerunType - Test hataları belirtilen eşiği aşarsa yeniden çalıştırmayın
string. İsteğe bağlı. when rerunFailedTests = truekullanın. İzin verilen değerler: basedOnTestFailurePercentage (% hata), basedOnTestFailureCount (başarısız test sayısı). Varsayılan değer: basedOnTestFailurePercentage.

Hata oranı belirtilen eşiği aştığında testlerin yeniden çalıştırılmasını önler. Bu, ortam sorunları büyük hatalara yol açıyorsa geçerlidir. Hataların yüzdesini veya başarısız test sayısını eşik olarak belirtebilirsiniz.


rerunFailedThreshold - Hata yüzdesi
string. İsteğe bağlı. when rerunFailedTests = true && rerunType = basedOnTestFailurePercentagekullanın. Varsayılan değer: 30.

Başarısız test çalışmalarının yüzdesi belirtilen eşiği aştığında testlerin yeniden çalıştırılmasını önler. Bu, ortam sorunları büyük hatalara yol açıyorsa geçerlidir.


rerunFailedTestCasesMaxLimit - Başarısız test sayısı
string. İsteğe bağlı. when rerunFailedTests = true && rerunType = basedOnTestFailureCountkullanın. Varsayılan değer: 5.

Başarısız test çalışması sayısı belirtilen sınırı aştığında testlerin yeniden çalıştırılmasını önler. Bu, ortam sorunları büyük hatalara yol açıyorsa geçerlidir.


rerunMaxAttempts - En fazla deneme sayısı
string. İsteğe bağlı. when rerunFailedTests = truekullanın. Varsayılan değer: 3.

Başarısız bir testin en fazla kaç kez yeniden denenmesi gerektiğini belirtir. Bir test, deneme sayısı üst sınırına ulaşılmadan önce geçerse yeniden çalıştırılmaz.


Görev denetim seçenekleri

Tüm görevlerde görev girişlerine ek olarak denetim seçenekleri vardır. Daha fazla bilgi için bkz . Denetim seçenekleri ve ortak görev özellikleri.

Çıkış değişkenleri

Yok.

Açıklamalar

Visual Studio Test çalıştırıcısını kullanarak birim ve işlevsel testleri (Selenium, Appium, Kodlanmış UI testi ve daha fazlası) çalıştırmak için bu görevi kullanın. MSTest tabanlı testlerle birlikte, Visual Studio test bağdaştırıcısına sahip test çerçeveleri de yürütülebilir, örneğin xUnit, NUnit veya Chutzpah.

. runsettings dosyasında uygun hedef çerçeve değeri belirtilerek hedef .NET Core çerçevesinin yürütülebildiğini test eder.

Testler, bu görevin 2. sürümü kullanılarak birden çok aracıya dağıtılabilir. Daha fazla bilgi için bkz. Visual Studio Test görevini kullanarak testleri paralel olarak çalıştırma.

Önkoşulları denetleme

Windows şirket içinde barındırılan aracı kullanıyorsanız, bu önkoşul yüklenmelidir:

Talep

Aracı aşağıdaki özelliğe sahip olmalıdır:

vstest

Vstest talebi iki şekilde karşılanabilir:

  1. Visual Studio aracı makinesine yüklenir.
  2. İşlem hattı tanımında Visual Studio Test Platformu Yükleyicisi görevini kullanarak.

Veri kaynağı olarak TestCase kullanan testleri nasıl çalıştırabilirim?

Veri kaynağı olarak TestCase kullanan otomatikleştirilmiş testler çalıştırmak için aşağıdakiler gereklidir:

  1. Aracı makinesinde Visual Studio 2017.6 veya üzeri olmalıdır. Visual Studio Test Platformu Yükleyicisi görevi, veri kaynağı olarak TestCase kullanan testleri çalıştırmak için kullanılamaz.
  2. "İş Öğeleri (tam)" kapsamı için yetkilendirilmiş bir PAT oluşturun.
  3. Değeri önceki adımda oluşturulan PAT değerine ayarlanmış olarak adlı Test.TestCaseAccessToken güvenli bir derleme veya yayın değişkeni ekleyin.

Bazı görev seçenekleriyle veri temelli xUnit ve NUnit testleri çalıştırırken sorunlarla karşılaşıyorum. Bilinen sınırlamalar var mı?

xUnit ve NUnit test çerçeveleri kullanan veri temelli testlerin bilinen bazı sınırlamaları vardır ve aşağıdaki görev seçenekleriyle kullanılamaz:

  1. Başarısız testleri yeniden çalıştırın.
  2. Testleri birden çok aracıya dağıtma ve toplu işlem seçenekleri.
  3. Test Etkisi Analizi.

Yukarıdaki sınırlamalar, bu test çerçeveleri için bağdaştırıcıların veri temelli testleri bulma ve raporlama şeklinden kaynaklanmaktadır.

VSTest görevi aynı anda birden çok hedef çerçeveyi hedefleyen testleri çalıştırmayı destekliyor mu?

Evet, SÜRÜM 17.3 VSTest'ten başlayarak aynı anda birden çok hedef çerçeveyi hedefleyen testleri çalıştırmayı destekler. Bundan önce , VSTest platformu tarafındaki bir sınırlama nedeniyle bu mümkün değildi.

Birden çok hedef çerçeveye ait testleri çalıştırmak istiyorsanız Visual Studio Test Platformu Yükleyicisi aracılığıyla uyumlu bir VSTest sürümü yüklemeniz ve bunu kullanacak şekilde toolsInstaller ayarlamanız vsTestVersion gerekir.

Test sonucu yayımlanırken şu hata alınıyor: Test sonuçları yayımlanamadı: Geçersiz Öncelik belirtildi mi?

Test yöntemlerinden herhangi birinin önceliği 255'in üzerindeyse, koddaki test yöntemi önceliğini düzeltirse ve testleri yeniden yürütürse bu hata oluşur. 255'ten büyük önceliğe sahip tüm testleri görmek için oluşturulan trx dosyasını gözden geçirebilirsiniz.

Gereksinimler

Gereksinim Açıklama
İşlem hattı türleri YAML, Klasik derleme, Klasik sürüm
Üzerinde çalışır Agent, DeploymentGroup
Talep Şirket içi barındırılan aracılar, bu görevi kullanan işleri çalıştırmak için aşağıdaki taleplerle eşleşen özelliklere sahip olmalıdır: vstest
Özellikler Bu görev, işteki sonraki görevler için hiçbir talebi karşılamaz.
Komut kısıtlamaları Herhangi biri
Ayarlanabilir değişkenler Herhangi biri
Aracı sürümü 2.103.0 veya üzeri
Görev kategorisi Test etme