ITestFilter Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Implemented by a user-supplied test filter that decides, on a per-test basis, whether the test should run, be silently dropped, or be reported as skipped.
public interface ITestFilter
[System.Diagnostics.CodeAnalysis.Experimental("MSTESTEXP", UrlFormat="https://aka.ms/mstest/diagnostics#{0}")]
public interface ITestFilter
type ITestFilter = interface
[<System.Diagnostics.CodeAnalysis.Experimental("MSTESTEXP", UrlFormat="https://aka.ms/mstest/diagnostics#{0}")>]
type ITestFilter = interface
Public Interface ITestFilter
- Attributes
Remarks
Implementations are registered via TestFilterProviderAttribute at the assembly level. The MSTest adapter materializes the filter lazily on the first test invocation for that assembly using the public parameterless constructor; the same instance is then reused for every test in the assembly.
Implementations should be allocation-free and thread-safe; Filter(TestFilterContext) may be invoked concurrently for tests in different classes.
Ordering with built-in filtering: ITestFilter is composed with — not a replacement for — the adapter's default filtering. Adapter-level filters such as the VSTest --filter command line or test-explorer selection run beforeITestFilter, so Filter(TestFilterContext) only ever sees tests that already survived those gates. By contrast, [Ignore] is evaluated afterITestFilter (it requires loading the declaring type, which ITestFilter is specifically designed to avoid). Returning Run does not override a later [Ignore]; an ignored test is still ignored.
Methods
| Name | Description |
|---|---|
| Filter(TestFilterContext) |
Decides whether the test described by |