Is it possible to call a Test task from the powershell loop you created in Azure Pipelines

坚强是说给别人听的谎言 提交于 2020-08-10 05:49:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!