I am using a ADO Task(VSTest@2) for my build pipeline(in Yaml)
Ref: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/vstest-v2?view=azure-pipelines
My test libraries are having this path on the build agent:
D:\a\1\s\Target\Release\net472\ABC.DEF.GH.IK.Tests.dll
If I use this configs, my tests are found and run:
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
**\Release\net472\*Test*.dll
!**\obj\**
platform: '${{ Parameters.BuildPlatform }}'
configuration: '${{ Parameters.BuildConfiguration }}'
searchFolder: '$(System.DefaultWorkingDirectory)'
timeoutInMinutes: 10
continueOnError: true
condition: eq(${{ Parameters.skipTests }}, false)
the above config will print this on my ADO task:
Source filter: **\*Tests.dll,!**\*TestAdapter*.dll,!**\obj\**
However, I want to fetch these paths for testAssemblyVer2 from parameters of the Yaml file. From here:
- name: TestFilePaths
type: object
default:
- '**\*Tests.dll'
- '!**\*TestAdapter*.dll'
- '!**\obj\**'
If I use
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
${{ join( '\n', Parameters.TestFilePaths) }}
it will print this when I run the pipeline and won't find any test:
Source filter: **\*Tests.dll\n!**\*TestAdapter*.dll\n!**\obj\**
##[warning]No test sources found matching the given filter '**\*Tests.dll\n!**\*TestAdapter*.dll\n!**\obj\**'
I have also tried the following combination as well, but that did not help:
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
${{ join( ',', Parameters.TestFilePaths) }}
escaped the paths in params as:
- name: TestFilePaths
type: object
default:
- '**\\\\*Tests.dll'
- '!**\\\\*TestAdapter*.dll'
- '!**\\\\obj\\\\**'
Please let me know how can I make this to work? I want to use the paths from the params and use it in the ADO task.