Test Filter Syntax Reference
Filter syntax depends on the platform and test framework.
VSTest filters (MSTest, xUnit v2, NUnit on VSTest)
Expression syntax: <Property><Operator><Value>[|&<Expression>]
Operators:
Combinators: | (OR), & (AND). Parentheses for grouping: (A|B)&C
Supported properties by framework:
An expression without an operator is treated as FullyQualifiedName~<value>.
Examples (VSTest):
MTP filters — MSTest and NUnit
MSTest and NUnit on MTP use the same --filter syntax as VSTest (same properties, operators, and combinators). The only difference is how the flag is passed:
MTP filters — xUnit (v3)
xUnit v3 on MTP uses framework-specific filter flags instead of the generic --filter expression:
Multiple values can be specified with a single flag: --filter-class Foo Bar.
xUnit v3 query filter language
For complex expressions, use --filter-query with a path-segment syntax:
Each segment matches against: assembly name, namespace, class name, method name. Use * for "match all" in any segment. Documentation: https://xunit.net/docs/query-filter-language
MTP filters — TUnit
TUnit uses --treenode-filter with a path-based syntax:
Wildcards (*) are supported in any segment. Filter operators can be appended to test names for property-based filtering.
Examples (TUnit):
VSTest → MTP filter translation (for migration)
MSTest, NUnit, and xUnit.net v2 (with YTest.MTP.XUnit2): The VSTest --filter syntax is identical on both VSTest and MTP. No changes needed.
xUnit.net v3 (native MTP): xUnit.net v3 does NOT support the VSTest --filter syntax on MTP. Translate filters using xUnit.net v3's native options:


