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
Nunit 4.0.x Test case selection is incorrect with certain test data #4584
Comments
Additional information... When run from the command line using ** Edit. I updated the "SelectionFail" tests to pass if they actually are run, so I updated the command line output below.
|
I also want to note that this was not an issue with Nunit 3.14.0 |
I tried your code, and I do see the same in Visual Studio. It is something with the naming here, if I do a SetName on each data to a "normal" name, then it works. I also see that it works from the command line. <TestFilter>
<filter/>
</TestFilter> Using Test Explorer, it does send all down as a list of testcases, so we then get a rather ugly filter: <filter><or><test>Nunit4_TestcaseSelectionIssue.SelectionFail.TestFailure([
1,
2,
3,
4,
5,
6
],4)</test><test>Nunit4_TestcaseSelectionIssue.SelectionFail.TestFailure([
1,
2,
3,
4,
5,
6
],2)</test><test>Nunit4_TestcaseSelectionIssue.SelectionFail.TestFailure([
1, There is then something in the framework/engine that doesn't like these test names. Why an extra test should make them appear again beats me right now. As a workaround: You can force it to not use any filter if you add @manfred-brands @stevenaw Any of you have any ideas where the selection for these filters are being done, or what can cause this behaviour? |
What are the implications of setting the |
It doesn't affect anything but the filtering of test cases sent to the framework. That setting is meant to fix the issue that Test Explorer was changed at some time to not send us Test All anymore, but just a list of testcases. If you have a lot of test cases, say >2000, it would slow down the test simply because of the parsing of that long list of tests. So when the number of tests are above this limit, we just clean the filter and let all tests run. If you define a category filter, it will still honor that filter. |
@OsirisTerje sorry, I had missed that you had pinged for thoughts here. I'm not at a computer for a few days, but will try to look soon. Definitely need to step through it to understand it. Initial thoughts: I can't recall any changes in how we'd enumerate something like a jsonarray to generate test cases but I think the biggest change in that area this release was async enumeration. I'm unsure if jsonarray could be taking the async path there? |
Oh, reading further I see that perhaps this is on the filtering side, as you mention. |
I cannot think of any changes that should affect this, so I'll have to try it out to come with a better answer |
I've been able to experiment a bit with the repro. It seemed as though commenting out the ignore didn't change anything, though the presence of another test did seem to be required to get the parameterized "success"case to run. |
This doesn't appear related to the in filter optimization as commenting it out doesn't seem to change anything. |
We have certain test cases that are using test data and expected results.
When the tests run in Microsoft Visual Studio 2022 (64-bit) Version 17.8.2, the tests get ignored.
I've created a sample project that recreates the issue: https://github.com/johnjaylward/Nunit4_TestcaseSelectionIssue
I managed to find a work around that does let the tests run by adding another Test with the same name, but does not use parameters.
In the test project the
SelectionFail
tests show the bug while theSelectionSuccess
test shows the workaround.The text was updated successfully, but these errors were encountered: