Search code examples
azure-devopsazure-pipelinescicd

VSTest Source filter changed and now tests are not found


I recently noticed that the unit tests step in our pipeline stopped working correctly, what I see now is that the value for the Source Filter changed from **\*test*.dll,!**\*TestAdapter.dll,!**\obj\** to **\bin\**\*test.dll,**\bin\**\*tests.dll and we don't have a bin folder in our output, other change I saw was the version for VSTest@2 from 2.198.0 to 2.227.0.

I'm not sure if that could cause the change in the Source filter value, I couldn't find any place to set it.

Any idea in how to fix it would be very appreciated! :)


Solution

  • You could specific the Source file by using testAssemblyVer2.

    - task: VSTest@2
      inputs:
        testSelector: 'testAssemblies'
        testAssemblyVer2: '**\*test*.dll,!**\*TestAdapter.dll,!**\obj\**'
        searchFolder: '$(System.DefaultWorkingDirectory)'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
    

    In addition, if you didn't set the source filter, the default value has been changed to **\bin\**\*test.dll,**\bin\**\*tests.dll. This issue seems caused by the update of VSTest Task.