You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assembly/Class initialize methods accept a TestContext instance as parameter. It's possible that some developers store this context in a field/property and then use this static instance in TestInitialize/TestCleanup, Dispose/DisposeAsync, in test methods or in methods providing arguments for parameterized tests. In the cases listed above, the user should instead use the instance TestContext property as it will contain up-to-date info related to current test while the static one will have only global information.
This rule should be enabled by default as Info as it won't cause any break to users but is definitely leading to some headache. On v4, we should consider bumping the severity to Warning.
Summary
Assembly/Class initialize methods accept a
TestContext
instance as parameter. It's possible that some developers store this context in a field/property and then use this static instance in TestInitialize/TestCleanup, Dispose/DisposeAsync, in test methods or in methods providing arguments for parameterized tests. In the cases listed above, the user should instead use the instanceTestContext
property as it will contain up-to-date info related to current test while the static one will have only global information.This rule should be enabled by default as Info as it won't cause any break to users but is definitely leading to some headache. On v4, we should consider bumping the severity to Warning.
Category of the rule should be usage.
Relates to #2051
AB#1986693
The text was updated successfully, but these errors were encountered: