问题
Is it possible to call a Test task from the PowerShell loop you created:
foreach ($i in ${{parameters.files}})
- task: VSTest@2
displayName: 'VsTest - testPlan'
inputs:
testSuite: '$i'
testConfiguration: '$(testConfig)'
Because when I tried to use:
- ${{ each item in parameters.files }}:
- task: VSTest@2
displayName: 'VsTest - testPlan'
inputs:
testSuite: '$item'
testConfiguration: '$(testConfig)'
it does not work as the and gets an error: Unexpected Values
Trying to use same pipelines looping logic from the link below: How to use output of a powershell command as parameters in Azure pipeline?
回答1:
Yes, you can refer to the current variable with ${{ variable }}
, for example:
- ${{ each item in parameters.files }}:
- task: VSTest@2
displayName: 'VsTest - testPlan'
inputs:
testSuite: '${{ item }}'
testConfiguration: '$(testConfig)'
来源:https://stackoverflow.com/questions/62492463/is-it-possible-to-call-a-test-task-from-the-powershell-loop-you-created-in-azure