Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Property | Value |
---|---|
Rule ID | MSTEST0050 |
Title | Global test fixture should be valid |
Category | Usage |
Fix is breaking or non-breaking | Non-breaking |
Enabled by default | Yes |
Default severity | Error |
Introduced in version | 3.10.0 |
Is there a code fix | No |
Cause
A global test fixture method (marked with GlobalTestInitializeAttribute
or GlobalTestCleanupAttribute
) doesn't follow the required layout or has invalid configuration.
Rule description
Global test fixture methods must follow specific requirements to ensure proper test execution. This rule validates that methods marked with GlobalTestInitializeAttribute
or GlobalTestCleanupAttribute
adhere to the correct method signature and configuration rules.
The method must be public
, static
, non-generic, have a single parameter of type TestContext
, and return void
or Task
. In addition, the containing type must be public
, static
, non-generic, and be marked with TestClassAttribute
.
How to fix violations
Ensure that global test fixture methods follow the required layout.
When to suppress warnings
Don't suppress warnings from this rule. Invalid global test fixture methods will not execute at run-time.