In your YAML file define the testPlanId
and testSuiteId
as pipeline variables.
and use these variables in the VS as VS Test Task using $(variableName).
trigger:
- master
pool:
vmImage: 'windows-2022'
variables:
testPlanId: '$(testPlanId)'
testSuiteId: '$(testSuiteId)'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '5.x'
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: |
echo "##vso[task.setvariable variable=testPlanId]$(newTestPlanId)"
echo "##vso[task.setvariable variable=testSuiteId]$(newTestSuiteId)"
displayName: 'Set Test Plan and Suite IDs'
- task: VSTest@2
inputs:
testSelector: 'TestPlan'
testPlan: '$(testPlanId)'
testSuite: '$(testSuiteId)'
searchFolder: '$(System.DefaultWorkingDirectory)'
Now when you run the pipeline the VS Test task will use the set Test Plan ID and Test Suite ID.
Hope this Helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.