Better Test Discovery #41
Replies: 2 comments 4 replies
-
Linking in #38 as one approach that was discussed via a PR for reference |
Beta Was this translation helpful? Give feedback.
-
Hi @Issafalcon, I'm running into some issues with parameterized tests with NUnit (although I suspect the issues apply to all test frameworks). In particular, it has to do with the mismatch between the parameters as parsed by tree-sittter, and the parameters as returned in the results file - I'm sure you're familiar with this issue already! I'll give you an example, this code: [TestCase(1, 1)]
[TestCase(2, 1)]
public void ParamTest(int a, int b)
{
Assert.AreEqual(a, b);
} One of these tests will pass, the other will fail, but neotest shows both of them as having passed. (I've spotted similar issues where both of them show as having failed, probably due to some previous state.) This is to the extent that I don't trust what I'm see in Vim and head back to the command line to see what's really going on with my tests. Let's have a look at the results file: <TestMethod codeBase=".../A.Test/bin/Debug/net7.0/A.Test.dll" adapterTypeName="executor://nunit3testexecutor/" className="A" name="ParamTest(2,1)" />
...
<TestMethod codeBase=".../A.Test/bin/Debug/net7.0/A.Test.dll" adapterTypeName="executor://nunit3testexecutor/" className="A" name="ParamTest(1,1)" /> You'll have noticed that there is a space in the parameters in the code ( Some of these issues could be fixed by simply normalising the whitespace, or normalising the case on boolean values, but the more complex expressions (arrays) seem to be intractable, or at least hard enough to make you think if this is the right approach. All this leads me to think that short of trying a very different approach altogether (for e.g. not using tree-sitter) that we should keep it simple and treat parameterized tests as a single test, that is, it has a single entry in the test list and a single result. Looking at the output would show output for all parameterised test runs, and should be enough to understand which of them had failed. I know this isn't ideal, but I'd prefer that it was limited in this way but reliable and understandable, than it supporting parameterized tests but only in very specific ways, and being broken and misleading in other cases. Indeed it's not obvious which cases are which until you start digging around in the code... What are your thoughts, then, to removing support for parameterized tests? Or at least making support for them optional? BTW otherwise I'm a very happy user of your plugin, especially the support for debugging with dap! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Hello!
Please use the discussion below to add any ideas to improve the test discovery / iron out any bugs with the Test Discovery mechanism of the adapter:
Beta Was this translation helpful? Give feedback.
All reactions