Search code examples
unit-testingbuildazure-devopsazure-pipelinesvstest.console.exe

Why test assemblies are not filtering in VSTS azure build pipeline despite putting test assembly patterns?


Here is my test assembly patterns (configuration)

**\$(BuildConfiguration)\*test*.dll
!**\obj\**  
!**\$(BuildConfiguration)\*Integration*

After triggering build, here is the log where integration test assembly is also there (this file must be filtered and should be here)

2019-04-23T13:10:33.6689787Z C:\VSTSAgent\A1\_work\1\s\myapp\myapp.Services.Test\bin\Release\myapp.Services.Test.dll
2019-04-23T13:10:33.6690018Z C:\VSTSAgent\A1\_work\1\s\myapp\myapp.Services.Integration.Test\bin\Release\myapp.Services.Integration.Test.dll

Becuase of this integration test cases are also running and I want to run only unit test cases.

Any idea?


Solution

  • I've found the solution, here is my latest configuration for the same which working absolutely as expected now.

    **\$(BuildConfiguration)\*test*.dll
    !**\obj\**
    !**\myapp\*Integration*\**  
    !**\*Microsoft.Owin.Testing.dll*
    !**\$(BuildConfiguration)\*Integration.Test*.dll
    !**\$(BuildConfiguration)\*Microsoft.VisualStudio.TestPlatform*
    !**\$(BuildConfiguration)\*MSTest*    
    !**\$(BuildConfiguration)\*Microsoft.Owin.Testing.dll*
    !**\$(BuildConfiguration)\*Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll*
    

    If you notice the line which says that exclude path which contains this pattern;

    !**\myapp\*Integration*\**
    

    and below pattern matches and will not be included in the result.

    2019-04-23T13:10:33.6690018Z C:\VSTSAgent\A1\_work\1\s\myapp\myapp.Services.Integration.Test\bin\Release\myapp.Services.Integration.Test.dll