Run Selective Test Classes in VSTS
<p>In Visual Studio Team Services (VSTS) when defining a build I can filter specific tests to be included or excluded when running tests.</p>

<p><strong>Question</strong>: How do I filter complete test classes from execution? The example in the screenshot demonstrates how I filter tests based on their category.</p>

<p><strong>Sample</strong> test class which I'd like to exclude:</p>

<pre><code>[TestClass] // .NET 4.5
public class SampleTests
{
    [TestMethod, TestCategory("Integration")]
    public void Test1() {}

    [TestMethod, TestCategory("Integration")]
    public void Test2() {}

    ...
}
</code></pre>

<p><strong>Current configuration</strong> to exclude my integration tests:</p>

<p><a href="https://i.stack.imgur.com/qILvK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qILvK.png" alt="test category filtering"></a></p>

<p><strong>Trial</strong>: The filter criteria <code>ClassName!=SampleTests</code> doesn't work. It seems to be reserved for store apps only. Fairly good documentation here: <a href="https://blogs.msdn.microsoft.com/vikramagrawal/2012/07/23/running-selective-unit-tests-in-vs-2012-rc-using-testcasefilter/" rel="nofollow noreferrer">MSDN Blog by Vikram Agrawal</a>.</p>

<p><strong>Reason for asking</strong>: I've got test classes initialize lots of data first before running any test and run a clean-up job at the end. When all my tests are excluded via the aforesaid filter the class initialization and clean-up still happen which consumes a lot of time and resources. I like to optimize this.</p>