Excluding integration tests in yaml not working

35 views Asked by At

I am trying to have two tasks for executing the integration tests:

  1. With external dependencies; and
  2. Without

Project names: My.Web.App.Sps and My.Web.Ap.Tests.Integration They are getting published in the following location:

tests/My.Web.App/My.Web.App.Sps/bin/Release/net48/ tests/My.Web.App/My.Web.Ap.Tests.Integration/bin/Release/net48/

- download: current
  artifact: tests

- task: VSTest@2
  displayName: 'Run int tests (without dependency)'
  inputs:
    testAssemblyVer2: |
     **\*test*.dll
     **\*sps.dll
     !**\*TestAdapter.dll
     !**\obj\**
    testFiltercriteria: 'TestCategory=IntegrationTest&TestCategory=${{ parameters.testEnvironment }}&TestCategory!=ExternalDependency'
    vsTestVersion: toolsInstaller
    runInParallel: false
    codeCoverageEnabled: false
    testRunTitle: 'Integration Tests without dependencies'

The other task is obviously without the ! sign in front of External dependency

I have tried to have sps and integration test separately but it passes without executing any tests.

If, however, I remove external dependency completely and have only the following filter:

'TestCategory=IntegrationTest&TestCategory=${{ parameters.testEnvironment }}'

It executes some tests but not all obviously.

1

There are 1 answers

0
Lucky On BEST ANSWER

You need to use searchFolder param

- download: current
  artifact: tests

- task: VSTest@2
  displayName: 'Run int tests (without dependency)'
  inputs:
    testAssemblyVer2: |
     **\*test*.dll
     **\*sps.dll
     !**\*TestAdapter.dll
     !**\obj\**
    testFiltercriteria: 'TestCategory=IntegrationTest&TestCategory=${{ parameters.testEnvironment }}&TestCategory!=ExternalDependency'
    searchFolder: '$(Pipeline.Workspace)/tests/My.Web.App'
    vsTestVersion: toolsInstaller
    runInParallel: false
    codeCoverageEnabled: false
    testRunTitle: 'Integration Tests without dependencies'