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
Since tests can be ignored by putting the [Ignore] attribute on the test class, I think it would make sense that the rule as also checking those cases as well.
Now it's just checking if the [Ignore] is put on the test method level.
Put [Ignore] next to the [TestClass] attribute and all the tests are ignored but the rule is not triggered.
Expected behavior
Rule should be triggered for the test class as well.
Additional improvement to be considered
Another rule which would fail if the Ignore attribute is put on the class level would also be satisfactory.
In our team people are putting the comment for ignoring the test as a parameter of the Ignore attribute. Maybe the rule could also take that comment as a valid fix.
For example:
[Ignore("Test is ignored because....")]
The text was updated successfully, but these errors were encountered:
I think the first part of the suggestion (checking the class level [Ignore]) is a good idea! Thanks for raising it.
Regarding the additional improvement, could you tell me where is defined the IgnoreAttribute you are using? Because the one defined in Microsoft.VisualStudio.TestTools.UnitTesting.IgnoreAttribute doesn't have the message constructor parameter.
valhristov
changed the title
Rule S1607 Should be applied for test classes as well
Fix S1607: Should be applied for test classes as well
Jan 31, 2018
Hi @Evangelink
Thanks for the very(!) prompt reply.
Actually we are using the IgnoreAttribute from the Microsoft.VisualStudio.TestTools.UnitTesting. I also saw that in the documentation there is no constructor with the message, however you can add it in the code. And even in VS you get the IntelliSense where it says that there is as overload with the message.
If you navigate to the definition you'll also see the constructor overload and a property for the IgnoreMessage.
We are using .NET 4.6.2.
Description
Since tests can be ignored by putting the [Ignore] attribute on the test class, I think it would make sense that the rule as also checking those cases as well.
Now it's just checking if the [Ignore] is put on the test method level.
RSPEC-1607
Repro steps
Put [Ignore] next to the [TestClass] attribute and all the tests are ignored but the rule is not triggered.
Expected behavior
Rule should be triggered for the test class as well.
Additional improvement to be considered
Another rule which would fail if the Ignore attribute is put on the class level would also be satisfactory.
In our team people are putting the comment for ignoring the test as a parameter of the Ignore attribute. Maybe the rule could also take that comment as a valid fix.
For example:
[Ignore("Test is ignored because....")]
The text was updated successfully, but these errors were encountered: