title: How to run filters on dotnet tests
body: <p>I have a build in VSTS, as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/T6nuz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/T6nuz.png" alt="enter image description here"></a></p>
  
  <p>You can see from the screen shot there's a test step to "Test and generate code coverage".  It uses this command:</p>
  
  <blockquote>
    <p>/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
    /p:CoverletOutput=$(Build.SourcesDirectory)\TestResults\Coverage\coverage</p>
  </blockquote>
  
  <p>Which allows the code coverage report to be generated.  I have added "Categories" to my xUnit tests with my defined Trait (such as integration or unit), to allow me to filter tests during build/release.  Example would be:</p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.Linq;
      using Xunit.Abstractions;
      using Xunit.Sdk;
  
      /// &lt;summary&gt;
      /// Decorates a test as a Unit Test, so that it runs in Continuous Integration builds.
      /// &lt;/summary&gt;
      [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
      public sealed class IsUnitAttribute : AICategoryAttribute
      {
          /// &lt;summary&gt;
          /// Initializes a new instance of &lt;see cref="IsUnitAttribute"/&gt;
          /// &lt;/summary&gt;
          public IsUnitAttribute() : base("Unit") { }
      }
  
      /// &lt;summary&gt;
      /// Decorates a test as an Integration Test, so that it runs in Continuous Integration builds.
      /// &lt;/summary&gt;
      [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
      public sealed class IsIntegrationAttribute : AICategoryAttribute
      {
          /// &lt;summary&gt;
          /// Initializes a new instance of &lt;see cref="IsIntegrationAttribute"/&gt;
          /// &lt;/summary&gt;
          public IsIntegrationAttribute() : base("Integration") { }
      }
  </code></pre>
  
  <p>I only know how to apply a filter in VS-Test step, as follows:</p>
  
  <p>But not when I'm testing using dotnet:</p>
  
  <p><a href="https://i.stack.imgur.com/oOLiR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oOLiR.png" alt="enter image description here"></a></p>
  
  <p>I only know how to build code coverage using dotnet (and not VS-Test)… I want to do both!  How do I:</p>
  
  <p>a) Add the commands to the VS-Test to generate the code coverage, the same as I do for dotnet using the command above.  </p>
  
  <p>OR</p>
  
  <p>b) Apply the filter to the dotnet Test step?</p>
  
  <p>Any pointers much appreciated!</p>