I'm running tests in Visual Studio 2017 from the Test Explorer window using the NUnit Test Adapter. I use a test playlist file which contains the tests I want to run. The contents of that file look like this:
<Playlist Version="1.0">
<Add Test="MyAssemblyName.MyTestFixture.MyTestMethod()" />
</Playlist>
Is there a schema for these Visual Studio playlist files? If so, where is it? If not, can you provide a list here of valid XML attributes for a Playlist file (other than <Add>
)?
I tried to find an XSD too, but I didn't, so I dug on Visual Studio dlls and found this one Microsoft.VisualStudio.TestWindow.Core.dll I used dnSpy to look the C# code, and I found this class PropertyRule
in namespace
Microsoft.VisualStudio.TestWindow.Internal.Playlists
For the property names all those are valid
PropertyRule.properties = ImmutableArray.Create<ValueTuple<string, TestPropertyType, string>>(new ValueTuple<string, TestPropertyType, string>[]
{
new ValueTuple<string, TestPropertyType, string>("Solution", TestPropertyType.Solution, string.Empty),
new ValueTuple<string, TestPropertyType, string>("Project", TestPropertyType.ProjectName, "TestWindow_ProjectName"),
new ValueTuple<string, TestPropertyType, string>("Namespace", TestPropertyType.NamespaceName, "TestWindow_NamespaceName"),
new ValueTuple<string, TestPropertyType, string>("Class", TestPropertyType.ClassName, "TestWindow_ClassName"),
new ValueTuple<string, TestPropertyType, string>("TargetFramework", TestPropertyType.TargetFramework, "TestWindow_TargetFramework"),
new ValueTuple<string, TestPropertyType, string>("Outcome", TestPropertyType.Outcome, "TestWindow_Outcome"),
new ValueTuple<string, TestPropertyType, string>("Trait", TestPropertyType.Trait, "TestWindow_Traits"),
new ValueTuple<string, TestPropertyType, string>("Test", TestPropertyType.FullyQualifiedName, "TestWindow_FullyQualifiedName"),
new ValueTuple<string, TestPropertyType, string>("TestWithNormalizedFullyQualifiedName", TestPropertyType.NormalizedFullyQualifiedName, "TestWindow_TestGroup"),
new ValueTuple<string, TestPropertyType, string>("DisplayName", TestPropertyType.DisplayName, "TestWindow_DisplayName")
});
Look the code for the Match attribute
using System;
namespace Microsoft.VisualStudio.TestWindow.Internal.Playlists
{
[Flags]
public enum PropertyRuleMatchFlags
{
Contains = 0,
Not = 1,
Equals = 2,
Subset = 4
}
}
Reading the code I was able to edit my playlist XML to ignore some project, so all others are added automatically!