-
Notifications
You must be signed in to change notification settings - Fork 641
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
False positives in try-catch blocks with Asserts revealed when using NUnit 3.10.0+ #301
Milestone
Comments
NightOwl888
added a commit
to NightOwl888/lucenenet
that referenced
this issue
Jun 30, 2020
…apter to 3.16.1, Microsoft.NET.Test.Sdk to 16.6.1 (apache#301)
NightOwl888
added a commit
to NightOwl888/lucenenet
that referenced
this issue
Jun 30, 2020
…ors(): Reflection doesn't throw exceptions when it cannot find a constructor in .NET, we need to test for null instead. (apache#301)
NightOwl888
added a commit
to NightOwl888/lucenenet
that referenced
this issue
Jun 30, 2020
… property that can be used to toggle "asserts" on and off in the release build, similar to how it works in Java. The setting can be injected by end users with the "assert" system property (which is a boolean). (apache#301)
NightOwl888
added a commit
to NightOwl888/lucenenet
that referenced
this issue
Jun 30, 2020
…apter to 3.16.1, Microsoft.NET.Test.Sdk to 16.6.1 (apache#301)
NightOwl888
added a commit
to NightOwl888/lucenenet
that referenced
this issue
Jun 30, 2020
…ors(): Reflection doesn't throw exceptions when it cannot find a constructor in .NET, we need to test for null instead. (apache#301)
NightOwl888
added a commit
to NightOwl888/lucenenet
that referenced
this issue
Jun 30, 2020
… property that can be used to toggle "asserts" on and off in the release build, similar to how it works in Java. The setting can be injected by end users with the "assert" system property (which is a boolean). (apache#301)
NightOwl888
added a commit
that referenced
this issue
Jun 30, 2020
…apter to 3.16.1, Microsoft.NET.Test.Sdk to 16.6.1 (#301)
NightOwl888
added a commit
that referenced
this issue
Jun 30, 2020
…ors(): Reflection doesn't throw exceptions when it cannot find a constructor in .NET, we need to test for null instead. (#301)
NightOwl888
added a commit
that referenced
this issue
Jun 30, 2020
… property that can be used to toggle "asserts" on and off in the release build, similar to how it works in Java. The setting can be injected by end users with the "assert" system property (which is a boolean). (#301)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some of the test asserts are structured in a way that makes them potentially catch any exception that NUnit throws to implement its behavior. For example:
We were getting some false positives in NUnit 3.9.0 and prior, since in those cases the catch block would swallow the exception that NUnit throws as well as the intended exception. However, NUnit patched this behavior in 3.10.0 and now these tests are failing.
Upgrading to a newer version of NUnit requires us to fix these broken statements that are falling through. In addition, we should also change these to
Assert.Throws
orAssert.ThrowsAnyOf
to make things easier to manage.Fortunately, I have reviewed the issues and none of the problems affect end users, they were just problems with injecting mock settings during testing. This issue is closely related to #267.
The text was updated successfully, but these errors were encountered: