How to run tests in a playlist file from mstest command line

mstest.exe has been deprecated. For Visual Studio 2012 SP1 and above we use vstest.console.exe. It still won't run your playlist file. There is a feature request open with Microsoft.

We're in a bad state right now with test lists also deprecated. The only way I can see to discriminate between different tests is to use Test Categories

Another option would be to switch to a different unit testing framework.

I wish there were a better answer.


As Nate Zaugg mentioned, there isn't currently a way to do it, but it's fairly easy to generate a list of tests programmatically.

The playlist file is just XML. It has a root node with child nodes. You can read the "Test" attribute of each node to get the FullyQualifiedNames of each of the tests you want to run. You can probably strip out the namespace and class before the test names at this point.

If you're able to use vstest.console.exe (which you should, with VS 2012), you can follow the instructions below. vstest.console.exe has the optional parameter "TestCaseFilter" which you can use to call out each test mentioned in the playlist. It's not particularly elegant, but it should work.

So, for some generic tests "MethodName1", "MethodName2", and "MethodName3", that are in the myTestFile.dll and myOtherTestFile.dll you would generate the following command:

vstest.console.exe myTestFile.dll myOtherTestFile.dll /Tests:MethodName1,MethodName2,MethodName3"