Closed zlepper closed 5 days ago
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.
But github actions is using dotnet test
and there is no minimum there, although it has been requested, see https://github.com/dotnet/sdk/issues/37101.
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.
Instead NUnit catches the exception, logs it and continues as if nothing happens
Yes, indeed it does. But we have lost the context, so need to figure out how we can inform the test host.
Also need to take it account the exceptions that are not to stop the testing, there are a couple of those.
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: https://github.com/nunit/nunit/issues/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: