MSTEST0007: Use test attributes only on test methods

Property Value
Rule ID MSTEST0007
Title Use test attributes only on test methods
Category Usage
Fix is breaking or non-breaking Non-breaking
Enabled by default Yes
Default severity Info
Introduced in version 3.3.0

Cause

A method that's not marked with TestMethodAttribute has one or more test attributes applied to it.

Rule description

The following test attributes should only be applied on methods marked with the TestMethodAttribute attribute:

How to fix violations

To fix a violation of this rule, either convert the method on which you applied the test attributes to a test method by setting the [TestMethod] attribute or remove the test attributes altogether.

When to suppress warnings

Do not suppress a warning from this rule. If you ignore this rule, your attributes will be ignored since they are designed for use only in a test context.