Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add analyzer for unnecessary [TestFixture] attributes #671

Open
sdrager-emoney opened this issue Dec 29, 2023 · 3 comments
Open

Add analyzer for unnecessary [TestFixture] attributes #671

sdrager-emoney opened this issue Dec 29, 2023 · 3 comments

Comments

@sdrager-emoney
Copy link

With NUnit 2.5, the [TestFixture] attribute is optional--the existence of a [Test] or [TestCase] is enough. It would be nice to have an analyzer option to enforce not using the attribute since it is now generally redundant.

Thank you

@manfred-brands
Copy link
Member

manfred-brands commented Dec 31, 2023

@sdrager-emoney Thanks for your suggestion. Personally I still put the [TestFixture] on all tests. This make it clear to me. Especially in case of a derived class which itself doesn't contain any [Test] only some overrides of a base class.

Having said that, I can always disable such a rule if it existed.
Are you willing to put up PR for such a rule?

@andrewimcclement
Copy link
Contributor

If we wanted to do this, we could possibly just mark [TestFixture] as [Obsolete] in NUnit, though doing that is less flexible than having a code analysis rule.

@manfred-brands
Copy link
Member

@andrewimcclement That will 'p...' a lot of people which have existing tests with [TestFixture] which are perfectly fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants