-
Notifications
You must be signed in to change notification settings - Fork 105
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
Failure during unit test discovery doesn't cause entire test suite to fail #1186
Comments
The framework crashes, then engine crashes, so do the adapter. However, the dotnet test runner (testhost) doesn't do that, it continues with the next one, or just terminates with no more. There is very little we can do here, because we have lost control. All our components have crashed, and can't change the state of that test or test suite. When using Azure Devops Pipelines, you can specify a minimum number of tests, that would report something like this. You could easily build your own little tool to check the number of executed tests and kill the build if that goes too low. I actually built such a tool some years ago, see https://www.nuget.org/packages/KDISim.CheckTest and source here: https://github.com/KDISim/CheckTest |
I apologise if I have misunderstood something here, however I did try to trace the code for this back when I reported this ticket. I don't believe the test host actually crashes here. Instead NUnit catches the exception, logs it and continues as if nothing happens, which means in this case no tests being reported available and the test assembly skipped. I believe if the test runner actually crashes, dotnet test will report a failure. |
It is I who should apologize. You are correct.
Yes, indeed it does. But we have lost the context, so need to figure out how we can inform the test host. But, we can't stop the test host. It will continue with the next assembly (or has already started the next one, in parallel). We could create a fake test case with the exception result, that should at least fail a CI run. |
@zlepper Take a look here. https://github.com/OsirisTerje/AdapterIssue1186/actions/runs/9946048865/job/27475685880 It now fails, using a constructed test representing the assembly. Some more details needed, but this is a way it can work. You can also test it yourself, using the myget package (4.6.0-beta.4). |
That looks great! As long as it informs me that "shits on fire" then I'm happy and will hopefully not have to come back to tests that have been failing for months or weeks later :D :D |
@zlepper Also seems the bug that crashed for you is in the process of getting fixed. https://github.com/nunit/nunit/pull/4760/files It will be out in NUnit 4.2, and this fix in adapter will be out in NUnit3TestAdapter 4.6. |
When reporting a bug, please provide the following information to speed up triage:
Currently NUnit has the following bug: nunit/nunit#4589 where a little test like this:
That uses the
[Explicit]
is currently causing test discovery to fail when combined with filtering:A bug like that itself is "fine". The main problem is that i just noticed we have not been running our tests properly in CI for a couple of months because of this. When this happens NUnit logs the warning and moves on. In my opinion it should really cause the entire test runner to fail so you know something is horribly wrong and should go investigate it
Csproj file:
The text was updated successfully, but these errors were encountered: