neotest-dotnet icon indicating copy to clipboard operation
neotest-dotnet copied to clipboard

Support for [Test] and [TestCase] attributes on same test

Open Coding-Journey opened this issue 8 months ago • 1 comments

Hi, neotest-dotnet adapter is great, enjoying using it to run .net tests, only 1 issue I'm facing:

"Using the [Test] attribute alongside [TestCase] attributes on the same method will cause neotest-dotnet to duplicate the item with erroneous nesting in the test structure. This will also break the ability of neotest to run the test cases" https://github.com/Issafalcon/neotest-dotnet?tab=readme-ov-file#nunit-limitations

Surely there is some kind of parser that can be added here? If there is a [Test] attribute on the line above a [TestCase] attribute, ignore the [Test] attribute?

Unfortunately our company codebase has lots of [Test] and [TestCase] attributes on tests together. We generally justify them with single responsibility principle, one attribute to define the fact it's a test, one attribute to give it a test case.

I'm surprised that this is an issue with NUnit, all the tests run correctly within VS; I wonder what they do differently?

Changing all the tests to not have this [Test] attribute is not a viable solution, any ideas on how I can run test cases without removing the [Test] attribute please? (Happy with either existing config fixes or direction to create a fork/pr - given there aren't reasons that this hasn't been done already that I'm missing)

Coding-Journey avatar Jun 23 '24 23:06 Coding-Journey