title: How to skip a Unit Test at runtime?
body: <p>Thanks in advance!</p>
  
  <p>We have some Automation tests using the selenium web driver which are great and provide a really good regression pack. </p>
  
  <p>The problem is now we have feature toggles in our code. So I need to say ignore these tests unless that feature toggle is turned On/ Off. I can't find anything really searching Google. </p>
  
  <p>Ideally I don't want a 'if' statement at the top of the Feature tests but it looks like it's going to be the main way. My initial thoughts where to create a custom attribute</p>
  
  <pre><code>public class IsFeatureFlagTurnedOn : Attribute
  {
     public IsFeatureFlagTurnedOn(string featureToggleName)
     {
        FeatureToggleName = featureToggleName;
     }
     public string FeatureToggleName {get;}
  }
  
  public class MyTests 
  {
     [TestMethod]
     [IsFeatureFlagTurnedOn("MyFeature1")]
     public void ItShould()
     {
        // only run if MyFeature1 is turned on
     }
  }
  </code></pre>
  
  <p>I some how need to hook into the MSTest pipeline and say if this attribute is present and the logic for MyFeature1 is turned off then don't run this test -  Looked at dynamically adding the [Ignore] but with no luck.</p>
  
  <p>This is running through VSTS and I could use [TestCategories] but I'd have to keep updating the pipeline to which feature is turned on/off which I don't want to do.</p>
  
  <p>Any help or suggestions would be great!</p>